ToList()方法

       //ToList()方法,翻译:把****转化为List集合。
      // 控制台试试:

string[] fruits = { "apple", "passionfruit", "banana", "mango","orange", "blueberry", "grape", "strawberry" }; List<int> lengths = fruits.Select(fruit => fruit.Length).ToList(); foreach (int length in lengths) { Console.WriteLine(length); } Console.ReadKey();
/* 5 12 6 5 6 9 5 10 */


来源: https://msdn.microsoft.com/zh-cn/library/bb342261(v=vs.110).aspx

原文地址:https://www.cnblogs.com/hao-1234-1234/p/6144829.html