score:3

Accepted answer

Operators are a set of extension methods on the IEnumerable interface providing query capabilities including : filtering, projection, aggregation, sorting. They can be applied to any enumerations and collections.

Keywords are a set of keywords added to the language(a language extensions) itself (C# or VB) that are used to construct a LINQ expression, under the hood keywords calls the corresponding operator. Not all operators have their corresponding keyword, only some of the more frequently used standard query operators have dedicated C# and Visual Basic language keyword syntax that enables them to be called as part of a query expression.

So, the difference between the two is the different form(visual impact) that they give to the code, under the hood same methods are called(operator extension methods).

Example from msdn :

       string sentence = "the quick brown fox jumps over the lazy dog";
       // Split the string into individual words to create a collection. 
       string[] words = sentence.Split(' ');

       // Using query expression syntax. 
       var query = from word in words
                   group word.ToUpper() by word.Length into gr
                   orderby gr.Key
                   select new { Length = gr.Key, Words = gr };

       // Using method-based query syntax. 
       var query2 = words.
           GroupBy(w => w.Length, w => w.ToUpper()).
           Select(g => new { Length = g.Key, Words = g }).
           OrderBy(o => o.Length);

Related Articles