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); } }
1. | Calling the ToList Operator | ||
2. | Convert Query result to a List | ||
3. | Convert an ArrayList to an IEnumerable |