Below code is used to sort string array using LINQ:-
static void Main(string[] args)
{
string[] data = { "Adam", "Sutro", "Lilly" };
List sortData = new List(data);
sortData.Sort((string a, string b) =>
{
return a.CompareTo(b);
}
);
Console.WriteLine(string.Join(",", sortData.ToArray()));
Console.Read();
} | |