Method 1:
Use Any
bool exists = Users.Any(usr => usr.id == "112");
Method 2:
Using Contains
List<string> FruitNames = new List { "Apple", "Banana", "Orange" }; bool exists = Fruits.Any(fruit => fruit.Contains(“Orange”));
Person person = personList.Find(delegate(Person pers) {return pers.ID == 1; });
No comments :
Post a Comment