C# 容器重用避免GC 的论证
var lst = new List<int>(); lst.Capacity = 100; var cnt = lst.Count; var cp = lst.Capacity; for(int i=0; i<30; ++i) { lst.Add(i); Console.WriteLine(i + "," + lst.Capacity + ",");//capacity总是100 lst.Clear();//并不会改变Capacity的大小 } lst.Clear();//并不会改变Capacity的大小 var cnt2 = lst.Count; var cp2 = lst.Capacity;