Hi All,
Can anyone let me know what difference between Linq order by & Linq Sort and why we used it.
Below is example for Orderby but how we can use the Sort
static void Main(string[] args)
{
string[] words = { "Blue", "Orange", "Banana", "Apple", "Apricot", "Annn" };
var wordGroups = from w in words
orderby w[0] descending
group w by w[0];
foreach (var wordgrp in wordGroups)
{
Console.WriteLine("Words that start with the letter '{0}':", wordgrp.Key );
foreach (var word in wordgrp)
{
Console.WriteLine(word);
Console.ReadLine();
}
}
}Many Thanks,
Shabbir