Returning a List : select : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » select »

 

Returning a List








    
 

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
    public static void Main() {
        int[] intArray = new int[] { 1, 2, 3 };
        List<int> ints = intArray.Select(i => i).ToList();

        foreach (int i in ints)
            Console.WriteLine(i);

        intArray[0] = 5;

        foreach (int i in ints)
            Console.WriteLine(i);
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» select