Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# object is in object list

public class A { public int Id {get;set;} public A() {} public A(int id) {Id = id;}}

List<A> list = new List<A>() { new A() { Id = 1}, new A() { Id = 2}};

bool containsItem = list.Any(item => item.Id == 3);
// this would return false.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #object #object #list
ADD COMMENT
Topic
Name
3+6 =