Welcome to
Hooked on LINQ. This website aims to be the premier community resource for LINQ (Language Integrated Query) for Microsoft®'s .NET.
You can read more about this site here. I hope you find this site useful and bookmark it as your landing place for LINQ related information. If you have
ideas or feedback about making this site better, then please add them to this
page, or
Email me.
EditLINQ to Coffee - LINQ Coffee Mug 
Keep a listing of the Standard Query Operators and the C# Query Expression Syntax on your desk!
|
EditTag Cloud (Number of pages by category)
|
EditCommon Topic Entry Points
TopEditWhat is LINQ?
It is a set of language changes and API's that allow you to write SQL-like queries natively in your chosen .NET programming language.
Sample LINQ to Objects Code over in memory collection:
var q = from call in callLog
where call.Incoming == true
group call by call.Number into g
join contact in contacts on g.Key equals contact.Phone
orderby contact.FirstName, contact.LastName
select new { contact.FirstName, contact.LastName,
Count = g.Count(),
Avg = g.Average( c => c.Duration ),
Total = g.Sum( c => c.Duration )};
| Ariel Hazelgrove - Calls:2, Time:27mins, Avg:13.5mins
Armando Valdes - Calls:2, Time:20mins, Avg:10mins
Barney Gottshall - Calls:4, Time:31mins, Avg:7.75mins
Chance Lard - Calls:2, Time:22mins, Avg:11mins
Mack Kamph - Calls:2, Time:44mins, Avg:22mins
Stewart Kagel - Calls:2, Time:13mins, Avg:6.5mins
|
Sample LINQ to XML Code - Generate XML from any datasource:
XElement xml = new XElement("Contacts",
from contact in contacts
orderby contact.LastName, contact.FirstName ascending
select new XElement("contact",
new XAttribute("email", contact.Email),
new XElement("FirstName", contact.FirstName),
new XElement("LastName", contact.LastName)));
|
<Contacts>
<contact email="jeff.deane@my-domain.com">
<FirstName>Jeffery</FirstName>
<LastName>Deane</LastName>
</contact>
<contact email="adamg@may-domain.com">
<FirstName>Adam</FirstName>
<LastName>Gauwain</LastName>
</contact>
</Contacts>
| |
TopEditHow to use this site
This website is based on the Wiki concept, originally invented by
Ward Cunningham, but introduced to the masses by
Wikipedia. It allows you to author and edit pages using a simple character markup language, rather than having to master HTML. Its other major pillar is that by allowing public editing of pages, the community at large correct errors, reaches concensus and brings the most up-to-date information on a subject to the forefront. It is my hope that we together achieve this goal on Hooked on LINQ.
For formatting help, visit the
Page Editing Section or at the ScrewTurn website.
To get a feel for the formatting syntax, play in the
Sandbox where it is impossible for you to cause any damage. Once you get used the syntax and have browsed the site to get a feeling for how the content on this site is organised, feel free to jump right in and add/modify or comment on the content.
Top