Query an array of object by its property value
using System; using System.Collections.Generic; using System.Linq; using System.Drawing; public class Book { public String Title { get; set; } public override String ToString() { return Title; } } class Program { static void Main(string[] args) { Book[] books = { new Book { Title="A" }, new Book { Title="F" }, new Book { Title="E" } }; var titles = books .Where(book => book.Title.Contains("A")) .Select(book => book.Title); } }
1. | Select object in a List | ||
2. | Query by Person's FirstName | ||
3. | Query a list of objects by its property |