Lambda expression is more logical than the Linq/Sql equivalent.
For example, both the below fragments yield the same thing (a
reordering from lowest to highest valued int) but I cannot understand
why the .orderby (r =r) works to reorder the numbers.
RL
//var orderLowToHigh = from m in orderHighToLow
// orderby m ascending
// select m;
//Console.WriteLine("HightoLow");
//foreach (int i in orderLowToHigh)
//{ Console.Write("ordrL>>H {0} ,", i); }
////works fine (more logical to understand than the below)
var orderLowToHigh = orderHighToLow.OrderBy(r =>
r).Select(r =r);
foreach (int i in orderLowToHigh)
{ Console.Write("L>>H {0} ", i); } //also works to reorder
from low to high!
Dan Tallent wrote:
I'm not sure exactly what your trying to do but something like this will
work
var HighesttoLowest = numbers
.OrderBy(r =r)
.Select(r =r);