OrderByDescending - Simple 1

Query
public void Linq32()
{
double[] doubles = { 1.7, 2.3, 1.9, 4.1, 2.9 };

var sortedDoubles =
from d in doubles
orderby d descending
select d;

Console.WriteLine("The doubles from highest to lowest:");
foreach (var d in sortedDoubles)
{
Console.WriteLine(d);
}
}
Lambda Expression
public void Linq32()
{
double[] doubles = { 1.7, 2.3, 1.9, 4.1, 2.9 };
var sortedDoubles = doubles.OrderByDescending(d => d);

Console.WriteLine("The doubles from highest to lowest:");
foreach (var d in sortedDoubles)
{
Console.WriteLine(d);
}
}
Output
The doubles from highest to lowest:
4.1
2.9
2.3
1.9
1.7
Related Tutorial
12. Reverse
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 # # # # #