How to check whether Generic List contains items or Not or what is the use of generic List Contains method?

 Posted by Rajesh_Kumar on 1/18/2014 | Category: VB.NET Interview questions | Views: 1212 | Points: 40
Answer:

With Contains method,we can check.It returns true if item is there in a List otherwise returns false.It's same as String Contains method which checks for particular Texts or Words in a string.So in case of List Contains,it does the same things.Instead of String,it checks items inside a List.

Syntax:-

If lst.Contains("any items") Then

'perform any action
End If


Where lst is my Generic List object.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response