how to check if a list of class objects contain an object? C# code example
Example 1: c# object list contaion parameters
public class A { public int Id { get; set; } public A(int id) { Id = id; } }
List<A> list = new List<A>() { new A() { Id = 1}, new A() { Id = 2} };
var matches = list.Where(item => item.Id == 1 || item.Id == 2);
for (int i = 0; i < matches.Count; i++) { Console.WriteLine(list[i]); }
Example 2: c# check list of objects for value
var matches = myList.Where(p => p.Name == nameToExtract);