C# LINQ select code example
Example 1: c# linq select from object list
var correct = answers.First(a => a.Correct);
var correct = answers.FirstOrDefault(a => a.Correct);
var allCorrect = answers.Where(a => a.Correct).ToList();
Example 2: linq query select where c#
var queryLondonCustomers = from cust in customers
where cust.City == "London"
select cust;
Example 3: c# linq list select
List<Model> newList = list.Where(m => m.application == "applicationname")
.Select(m => new Model {
application = m.application,
users = m.users.Where(u => u.surname == "surname").ToList()
}).ToList();