calling ToList.

image_pdfimage_print
   
 

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

    


This entry was posted in LINQ. Bookmark the permalink.