How to remove all the items from a List collection?

 Posted by vishalneeraj-24503 on 12/20/2013 | Category: C# Interview questions | Views: 3307 | Points: 40
Answer:

With the help of Clear() Static method of List collection,we can remove all the items from List collection.

For Example:-

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


lst_id.Add(1);
lst_id.Add(2);

//To remove all items from lst_id
lst_id.Clear();


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response