calling ToList. : ToList « LINQ « C# / CSharp Tutorial






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);
    }
}








22.23.ToList
22.23.1.Calling the ToList Operator
22.23.2.Convert Query result to a List
22.23.3.Convert an ArrayList to an IEnumerable That Can Be Used with the Typical Standard Query Operators
22.23.4.calling ToList.