LINQ is a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities.
Benefits of LINQ:
- It provides rich Meta data.
- Compile-time syntax checking
- LINQ is static typing and provide intelliSence (previously available in imperative code).
- It provides query in concise way.
Example
using System.Collections.Generic; using System.Linq; string[] Country = { "India", "SriLanka", "China", "Nepal", "Newzeland", "South Africa","America", "England" };
//In this section using LINQ Query IEnumerable<string> query = from s in Country
where s.Length == 5
orderby s
select s.ToUpper();
foreach (string item in query) Console.WriteLine(item);
Anonymous User
09-Mar-2019Thanks for sharing.
John Smith
17-Nov-2010