Article
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    API(s)
    Sencha-Touch
    Single Page App
    Bootstrap
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog

Home >> LINQ >> LINQ (Language Integrated Query)
LINQ (Language Integrated Query)
LINQ (Language Integrated Query)


by Amit Singh on 11/27/2010 8:53:22 PM

Views: 6179       Comments: 1

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.

 

 LINQ to objects

The term "LINQ to Objects" refers to the use of LINQ queries with any IEnumerable or  IEnumerable <T> collection directly, without the use of an intermediate LINQ provider or API such as or LINQ to XML, LINQ to SQL.

 

LINQ to SQL.

In Linq to sql , it changes into object model and sends to database for execution. After execution it find the result. So we easily maintain the relational database like query.

 

LINQ to XML

LINQ to XML provides an easy query interface for xml files. We do with linq to xml to read and write data from/to xml file, using the file for persistency maintaining a list of objects. Linq to xml can be used for storing application settings, storing persistent objects or any other data needs to be saved.

How use the LINQ in our program

Step1: we open the console application and write these codes

 

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);

 

Step2:Run it

 

Output:

India

China

Nepal

 

Report Abuse Form
Reason:    
 


LINQ
by John Smith 3/25/2011 4:35:27 AM
Good One!
Report Abuse
Title :
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
     
 
Latest Article by Amit SinghRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 5221
Advertisement
MindStick DataConver
Advertise with Us
  
Copyright © 2009 - 2014MindStick. All Rights Reserved.