//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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-19
相关资源
相似解决方案