Collection initializer is a new featured added to C# 3.0. Let's take a look at this sample code:
List<string> names = new List<string>();
names.Add("Mahesh Chand");
names.Add("Mike Gold");
names.Add("Matt Chochran");
names.Add("Praveen Kumar");
var selectedNames = from name in names
select name;
foreach(var n in selectedNames)
Console.WriteLine(n);
Console.ReadLine();

Join the conversation! Your thoughts help the community grow.