开发者

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 a Predicate<(Of <(T>)>) generic delegate.


MyList.Clear();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜