dotnetspider.com


 


TutorialsForumResourcesReviewsJobsInterviewVideosCommunitiesProjectsTraining

Subscribe to Subscribers


Online MembersSankar
Sunitha
cloud
Rajalingam
SivaSaiKrishna
Ashokkumar
er.g.ilango
Anu George
Krishna Kant
parameswaran
More...




Resources » Articles » .NET Framework


What is LINQ - Part 1


Posted Date:     Category: .NET Framework    Rating: 1 out of 5
Author: Member Level: Gold    Points: 10


Language Integrated Query

LINQ is the composition of general purpose standard query operators that allow us to work(traversal, filter and projection) with data regardless of the data source in any .net based programming language.

The standard query operators all the queries to act on any IEnumerable based datasource.

LINQ to XML
Here the query operators acts on XML using an in-memory XML facility providing XPath & XQuery functionality in the .net based language.

LINQ to SQL
Here the query operators acts on relational data build on integration of SQL-based schema definitions into the common language runtime's type system

Getting Started


string[] employee =
{ "Granville", "John", "Rachel", "Betty",
"Chandler", "Ross", "Monica" };

public static void Query() {
IEnumerable resultSet =
from emp in employee
where emp.Length == 5
orderby e
select e;

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



In the above code you can see query operators like select, where, orderby and from.


= from emp in Employee where emp.Length == 5 orderby e select e;

The above code is identical to below

= employee.Where(emp => emp.Length == 5)
.OrderBy(emp => emp)
.Select(emp => emp);


Above the arguments to the operations (Where, OrderBy and Select) are called as lambda expressions

This article will be continued.


Did you like this resource? Share it with your friends and show your love!





Responses to "What is LINQ - Part 1"
Author: Trupti    30 Jul 2008Member Level: Silver   Points : 0
nice one.
Can u please explain benefits of using LINQ?



Author: Happy Coder    31 Jul 2008Member Level: Gold   Points : 2
LINQ is a new addition to .NET that lets us to query inline data / in-memory date as they probably would be used to doing with standard SQL-type syntax.

AS in above example you could see, "employee" is an in memory array(can also use collection) and we are getting the results in a similar way as we query a table.

Note: This works only >= C# 3.0



Author: Happy Coder    31 Jul 2008Member Level: Gold   Points : 2
LINQ is a new addition to .NET that lets us to query inline data / in-memory date as they probably would be used to doing with standard SQL-type syntax.

AS in above example you could see, "employee" is an in memory array(can also use collection) and we are getting the results in a similar way as we query a table.

Note: This works only >= C# 3.0



Author: Trupti    31 Jul 2008Member Level: Silver   Points : 1
Oh thanks for information.
But actually what i want to asked is when and in which type of application we prefer to use LINQ? b'coz as per my knowledge there are some limitation in to LINQ it self like it does not support nested inner query...



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: About NUnit
    Previous Resource: Type Conversion Functions
    Return to Resources
    Post New Resource
    Category: .NET Framework


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    LINQ  .  What is LINQ  .  LINQ introduction  .  

    My Profile

    Active Members
    TodayLast 7 Daysmore...


    Awards & Gifts


    Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds



    About Us    Trademark Disclaimer    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.