LINQ with LINQPad
My latest project at work has me working with LINQ to SQL. This is definitely cool stuff!
If you are not familiar with LINQ, it is a new feature of .NET 3.5 (C# 3.0/VB 9.0) and stands for Language INtegrated Query. It offers query syntax that can be used to query in-memory objects, XML, Databases, and more. You can learn more about LINQ here, here and here.
As I started working with LINQ, I found myself writing SQL queries and then working backwards to translate them into the appropriate LINQ syntax. This was fine to get the first couple of queries running and allowing me to get my project moving, but I wanted to be able to write LINQ queries without the SQL step and I wanted to be able to test them outside of the context of my application.
I found LINQPad, and it was exactly what I was looking for. To simplifiy, LINQPad allows you to write and run LINQ queries in a similar fashion to writing SQL queries in SQL Server Management Studio or Query Analyzer before that.
LINQPad comes pre-loaded with a couple hundred sample queries and can be used to run snippets of C# 3.0 or VB 9.0 code, not just LINQ queries!
If you are working with LINQ, this is a great way to practice, learn, test and just keep thinking in LINQ when simply querying your databases.