c# linq sort list descending code example
Example 1: order by length descending C#
string[] l_Data = { "1", "22", "333" };
l_Data = l_Data.OrderByDescending(x => x.Length).ToArray();
Console.WriteLine(l_Data);
Example 2: c# sort list
using System;
class Program
{
static void Main()
{
string[] colors = new string[]
{
"orange",
"blue",
"yellow",
"aqua",
"red"
};
// Call Array.Sort method.
Array.Sort(colors);
foreach (string color in colors)
{
Console.WriteLine(color);
}
}
}