How to empty a List<T>?
I have a list:
List<int> MyList = new List<int>();
I added 10 int values in it:
for{i=1;i<10;i++}
MyList.Add(1);
Can I make it empty in one shot, rather than us开发者_开发技巧ing
- 10 times iteration of
Remove
function RemoveAll
method with aPredicate<(Of <(T>)>)
generic delegate.
MyList.Clear();
精彩评论