Create and initialize the list of Simple type with LINQ syntax in CSharp
Description
The following code shows how to create and initialize the list of Simple type with LINQ syntax.
Example
//from w ww . j av a 2 s . c o m
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
public class MainClass{
public static void Main(string[] args){
List<String> Names = new List<string>
{
"A",
"A",
"Z",
"C",
"R"
};
foreach (String ThisName in Names)
Console.WriteLine(ThisName);
}
}
The code above generates the following result.