LINQ to SQL cheat sheet
- đź“…
- đź“ť 58 words
- đź•™ 1 minute
- 📦 .NET
- 🏷️ LINQ, VB.NET, C#
- đź’¬ 14 responses
A few short words to say I’ve put together a cheat sheet for LINQ to SQL with one page for C# and another for VB.NET.
It shows the syntax for a number of common query operations, manipulations and attributes and can be a very useful quick reference :)
Download LINQ to SQL cheat sheet (PDF) (76 KB)
[)amien
14 responses to LINQ to SQL cheat sheet
Thanks, its really shortest way to implement query using LINQ.
Thanks a LOT. I’m doing a project and having to learn this stuff on the fly. This helps!
Thanks Damien. I’m just starting a project that I wanted to use LINQ with, and this will help me a lot!
You just managed to teach me LINQ to SQL in one A4Â page. Thanks alot!
Thanks for the cheat sheet. It is just the one I was looking for.
Damien,
Thank you for the cheat sheet! I made a similar one for LINQ Standard Query Operators
Hope this helps anyone, Milan
Excellent and thanks! But one word though:
landscape
The boxes are cramped horizontally, maybe Landscape would allow for formatted code(?). Yes I know, everyone is a critic.
Thanks Jim, I’ll update the sheet over the weekend with your changes.
I have written a fair amount of code in VB.Net but I have to admit it was all prior to .NETÂ 3.5.
On your VB sheet, you should consider using the VB’s additional support of query operators Distinct, Skip, Take, Aggregate, Sum, Count, Etc. For example the Paging and Ordering example could be re-written in VB as:
Also, notice the Select is optional in VB if you project the entire object. When using a simple projection, you don’t need the object initializer syntax either. If you just wanted to project the ContactName and City in the above example, you could do the following:
VB takes away a number of the method syntax hurdles that C#Â requires.
Nice job, Damien! Your efforts are appreciated!
Very neat. I think you should put a link to the cheat sheet as a pegged topic in the msdn linq forums…
@Harry I just enabled it for Google Reader, which one are you using?
@Everyone Else: Thanks for the compliments guys. I’ve never been so retweeted.
Thanks for the sheet, I can see this being very helpful. It’s also quite nice that you split the C# & VB into separate pages.
This is excellent, thanks!