class Program
{
public class MyEntity
{
public int property1;
public int property2;
public int property3;
}
static void Main(string[] args)
{
List<MyEntity> entities = new List<MyEntity>();
entities.Add(new MyEntity() { property1 = 1 });
entities.Add(new MyEntity() { property1 = 1 });
entities.Add(new MyEntity() { property1 = 1 });
entities.Add(new MyEntity() { property1 = 1 });
entities.ForEach(p => p.property1 = 2);
Console.ReadLine();
}
}
Also, to make a select call without using for syntax:
List<MyEntity> filter = entities.Where(p => p.property1 == 2).ToList();
Where and Select without using for syntax:
list.Where(p => p.Property1 == value).Select(p => p.Property2Name).FirstOrDefault()
Comments
Post a Comment