You need to write code manually to sort individual variables.
For primitive type you can use below code - Descending Order
var data = new[] { "a", "tar", "web", "coal", "sort" };
data = data.OrderByDescending(x => x).ToArray();
foreach (var item in data)
{
Console.WriteLine(item);
}
Ascending Order
var data = new[] { 4, 5, 6, 2, 1 };
data = data.OrderBy(x => x).ToArray();
foreach (var item in data)
{
Console.Write(item);
}
but if you want to sort collection (reference type) then you can use IComparable and IComparer Interface.
Sorting Lists using IComparable and IComparer Interface in .NET[
^]