• Log in or sign up for an account here: https://www.sythe.org/login

cegonsoft coimbatore | Learn LINQ

danhar09

Newcomer
Joined
Sep 10, 2011
Sythe Gold
0
Messages
2
.NET 3.5 introduces a new technology called Language Integrated Query, or LINQ (pronounced‘‘link’’). LINQ is designed to fill the gap that exists between traditional .NET languages, which offer strong typing and full object-oriented development, and query languages such as SQL, with syntax specifically designed for query operations. With the introduction of LINQ into .NET, query becomes a first class concept in .NET, whether object, XML, or data queries.

LINQ includes three basic types of queries, LINQ to Objects, LINQ to XML (or XLINQ), and LINQ to SQL (or DLINQ). Each type of query offers specific capabilities and is designed to query a specific source.

LINQ to Objects allows .NET developers to write “queries” over collections of objects.

LINQ frees you from having to write looping code; it allows you to write queries that filter a list or calculate aggregate functions on elements in a collection as a set.

We can write queries against any collection type that implements an interface called IEnumerable (and also a new interface called IQueryable)

This is almost any collection type built into the .NET class libraries including simple arrays like string[], or int[], and any List<T> collection we define.

Let us look at a few of the simplest examples to understand the basic syntax.

int[] nums = new int[] {0,4,2,6,3,8,3,1};
var result = from n in nums where n < 5 orderby n select n;
foreach(int i in result) Console.WriteLine(i);

Output: 0 1 2 3 3 4

more information at Cegonsoft
 
Runescape Gamblingrunescape gambling
Back
Top