Home > DeveloperSection > Blogs > LINQ in .NET

LINQ in .NET


LINQ LINQ 
Ratings:
1 Comment(s)
 2122  View(s)
Rate this:
LINQ (Language Integrated Query)

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.
In LINQ we used same format as SQL but some difference like positioning, style in Select, where etc. We use the System.Linq namespace.

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.
We create LINQ between LINQ to object, LINQ to XML, LINQ to SQL.

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
  select s.ToUpper();

foreach (string item in query)
Console.WriteLine(item);



LINQ

By John Smith on   6 years ago
Good One, Thanks!

Don't want to miss updates? Please click the below button!

Follow MindStick