LINQ(Language Integrated Query)
- LINQ is a uniform programming model for any kind of data access. LINQ enables you to query and manipulate the data independently of data sources.
- Its like a query language which can query any data source and any transform. LINQ also provide full type safety and compile time checking.
- LINQ can serve as a good entity for middle tier. So it will sit in between the UI and the data access layer.
- LINQ uses an SQL-like syntax to make query expressions well beyond the capabilities of embedded SQL as implemented in programming languages.
- LINQ (Language Integrated Query) is a Microsoft programming model and
methodology that essentially adds formal query capabilities into
Microsoft .NET-based programming languages.
Simple example of LINQ:
using System;
using System.Linq;
using System.Collections.Generic;
class appnew {
static void Main() {
string[] names = { "Tom", "harry", "Frank", "David", "John" };
IEnumerable<string> query = from s in names
where s.Length == 5
orderby s
select s.ToUpper();
foreach (string item in query)
Console.WriteLine(item);
}
}
compile and run this program, the output is shown as:
harry
Frank
David
No comments:
Post a Comment