LINQ : means Language integrated query.When we create SQL Query for select particular data .For example, country same way write query in C# for find particular information in Quickly.This technology, integrated query language, and enter the extension methods. This work lists and array(matrices). So I use Group is not yet in memory.
Linq Example
We use the Distinct extension method to Distinct all the elements in an int array. A Remove duplicated elements in it single value is returned.
The Distinct method is implemented as an extension method within the. NET Framework. Extension methods are a special syntax.
Program that uses LINQ
extension: C#
using System;
using System.Linq;
They convert to
an array,-->ToArray
Dictionary,--> ToDictionary List-->ToList
Mutate. These methods liquidation or mutate. Change elements in your query one way or another. We remove unnecessary items, and add new ones, or change other aspects of the same items.
Skip and Take. These methods useful guidance. They eliminate the need for custom code to check ranges. Skip passes over the first elements.
Example: Skip,SkipWhile,TakeWhile
Computation. LINQ also provides computational methods. These act on a given query and then return a number or other value. They can also simplify the code.
Example of: Average
Aggregate
Count-Conditional
Sum
Max and min. We can search a collection for larger (max) or small (min) value. This is effective for many types of value. What is the tallest tower?
Example: Min-Max
Query. Uses a declarative query expression clauses. These determine the results we want, not how we are to achieve them. To start, we use the query expression on the set of integers.
Imperative: You describe how to perform the task, each step indicating code instructions.
Declarative: You describe the end result needed, leaving the steps until the query language.
Example:Query
Advantage:
LINQ is a powerful feature. Methods and query expressions often improve the readability of programs.
And which sometimes lead to new, Delay, Algorithms above.
0 comments:
Post a Comment