更新时间:2023-11-11 22:34:58
.NET 2.0有 ConvertAll
方法,您可以在其中传递转换函数:
.NET 2.0 has the ConvertAll
method where you can pass in a converter function:
List<int> l1 = new List<int>(new int[] { 1,2,3 } );
List<string> l2 = l1.ConvertAll<string>(delegate(int i) { return i.ToString(); });