C# list中ConvertAll的使用
2021-05-17 14:29
标签:add console stat integer ble int line read rgs C# list中ConvertAll的使用 标签:add console stat integer ble int line read rgs 原文地址:https://www.cnblogs.com/xieweikang/p/11775775.html 1 static double TakeSquareRoot(int x)
2 {
3 //return Math.Sqrt(x);
4 return x + 1;
5 }
6
7 static void Main(string[] args)
8 {
9 Listint> integers = new Listint>();
10 integers.Add(1);
11 integers.Add(2);
12 integers.Add(3);
13 integers.Add(4);
14
15 Converterint, double> converter = TakeSquareRoot;
16 Listdouble> doubles;
17 doubles = integers.ConvertAlldouble>(converter);
18 foreach (double d in doubles)
19 {
20 Console.WriteLine(d);
21 }
22
23 Console.WriteLine("OK");
24
25 Console.ReadKey();
26 }
文章标题:C# list中ConvertAll的使用
文章链接:http://soscw.com/index.php/essay/86757.html