BindingListnames = new BindingList {"Alice", "Bob", "Charlie"}; bool containsAlice = names.Contains("Alice"); bool containsDave = names.Contains("Dave"); // containsAlice is true, containsDave is false
public class Person { public string Name { get; set; } public int Age { get; set; } } BindingListIn both examples, the Contains method returns true if the item or the object with the specified property value is found in the BindingListpeople = new BindingList { new Person { Name = "Alice", Age = 35 }, new Person { Name = "Bob", Age = 42 }, new Person { Name = "Charlie", Age = 28 } }; bool containsBob = people.Contains(new Person { Name = "Bob", Age = 42 }); bool containsYoung = people.Contains(p => p.Age < 30); // containsBob is true, containsYoung is false