c# asp net check if collection contains code example
Example: 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);
// matches = [0, 1]
// can be used like
for (int i = 0; i < matches.Count; i++) { Console.WriteLine(list[i]); }