Select expects a return of type T (your concrete class). In the following. We don't need to be concerned with IQueryable aspect, just a the .List -> Select.
Using
namespace Example1.Classes
{
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Id { get; set; }
public bool Active { get; set; }
public bool IsNew { get; set; }
}
}
We can change a property value, in this case all person objects in the list.
Change IsNew
using System;
using System.Collections.Generic;
using System.Linq;
using Example1.Classes;
namespace Example1
{
public class Operations
{
public Operations()
{
List<Person> list = GetPeopleList();
list.ForEach(person => person.IsNew = true);
}
public List<Person> GetPeopleList()
{
return new List<Person>
{
new Person()
{
Id = 1,
FirstName = "Pete",
LastName = "Smith",
Active = true,
IsNew = false
},
new Person()
{
Id = 2,
FirstName = "Karen",
LastName = "Payne",
Active = true,
IsNew = false
},
new Person()
{
Id = 3,
FirstName = "Jane",
LastName = "Williams",
Active = true,
IsNew = false
}
};
}
}
}