calling ToList. : ToList : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » ToList »

 

calling ToList.








    
 

using System;
using System.Collections.Generic;
using System.Linq;
public class MainClass {
    public static void Main() {

        var numbers = new List<int>() { 1, 2 };

        List<int> timesTen = numbers
          .Select(n => n * 10)
          .ToList();
        numbers.Clear();
        Console.WriteLine(timesTen.Count);
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» ToList