C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






LINQ Introduction


Posted Date: 03 Apr 2008    Resource Type: Articles    Category: Web Applications

Posted By: Kamal       Member Level: Gold
Rating:     Points: 15



Language Integrated Query (LINQ), a new query language feature in .net 3.5.

You can use it to retrieve data from an array or collection or any data source that supports IEnumerable or IQueryable.

Let's see example how to use LINQ in string array.We have string array of country like this,


Dim countries As String() = {"Australia", "Brazil", "China", "Japan", "India", "United States", "United Kingdom"}
Dim data = From country In countries Where country.StartsWith("Uni") Select country.ToUpper
Response.Write("Country List</br>")
For Each country As String In data
Response.Write(country & "</br>")
Next


Here, you have only change "LINQ Query" with query that discuss below.

==> By using LINQ you can retrive data from array. Below LINQ equivalent to SELECT * statement of SQL Server.

From country In countries Select country

==> You can also use conditional statement in array to get data.To retrive country list that have string length less than 6.

From country In countries Where country.Length < 6 Select country

==> You can also sort an array Ascending/Descending.

From country In countries Order By country Descending Select country

==> To retrive Country name that start with "UNI" and country name in Upper case.

From country In countries Where country.StartsWith("Uni") Select country.ToUpper

Here, I have explain how use LINQ.




Responses

Author: http://venkattechnicalblog.blogspot.com/    07 Apr 2008Member Level: Diamond   Points : 0
Thanks for this info. Nice article.

Regards,
Venkatesan Prabu . J


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to display user’s full name using Active directory?
Previous Resource: Referencing Controls in Templates after mode changes in Formview
Return to Discussion Resource Index
Post New Resource
Category: Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

audio conferencing services

Contact Us    Privacy Policy    Terms Of Use