Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Difference between Linq order by & Linq Sort

$
0
0

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


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>