...

/

Sweetening LINQ Syntax with Syntactic Sugar

Sweetening LINQ Syntax with Syntactic Sugar

Learn about LINQ syntax, filtering, and sorting with the extension method.

LINQ query comprehension syntax

C# 3.0 introduced some new language keywords in 2008 to make it easier for programmers with experience with SQL to write LINQ queries. This syntactic sugar is officially called the LINQ query comprehension syntax. Consider the following array of string values:

Press + to interact
string[] names = new[] { "Michael", "Pam", "Jim", "Dwight",
"Angela", "Kevin", "Toby", "Creed" };

Filtering and sorting with

...