What is the use of Exists method of Generic method in C#?

 Posted by Rajesh_Kumar on 1/18/2014 | Category: C# Interview questions | Views: 715 | Points: 40
Answer:

Exist returns true if a List item is found otherwise returns false.We have to match with predicate parameters.

For Example:-

List<int> lst = new List<int>();

lst.Add(1);
lst.Add(2);
bool exists = lst.Exists(value => value > 1);


It returns true because we have checked here value > 1,and List also contains 2.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response