Snippet Compiler versus LINQPad

Snippet Compiler versus LINQPad

technology

Jeff Key’s Snippet Compiler is a popular developer tool that has been around for years – I first learned about it in a 2004 MSDN article titled “Ten Must-Have Tools Every Developer Should Download Now”. I still use it from time to time, but over the last year or so it has been mostly replaced in my toolbox by LINQPad.

Last updated in late 2007, Snippet Compiler has lagged behind the times. It provides “Alpha level” support for .NET 3.5 / C# 3.0, and the support for new features is less than stellar; for example, the System.Core assembly is not automatically referenced (where the System.Linq namespace lives), the Intellisense system does not show extension methods, and the editor doesn’t recognize query comprehension syntax or lambda expressions.

Snippet Compiler - C# 3.0 screen shot 

Notice the squiggly red lines under the newer language constructs. Of course, it’s valid (and the code compiles and runs), but one of the main purposes of a snippet compiler is to help the developer to write the code in the first place.

LINQPad, on the other hand, was originally written to serve a slightly different purpose. It is a companion to the absolutely essential book “C# 3.0 In a Nutshell” and comes with hundreds of example queries from that book.

It is free to download, and for a very small license fee you can enable the AutoCompletion / Intellisense feature that makes this a very capable code snippet editor.

Support for LINQ and lambda expressions is top notch, allowing you to even connect to a database and write test LINQ to SQL statements without creating your own data context. Output can be done with the “Dump” extension method which will automatically iterate over your collection and display the results in a grid:

int[] numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

// As a lambda query
numbers.Where(n => n > 5).Select(n => n).Dump();

// As a comprehension query
var query = from n in numbers
    where n > 5
    select n;
    
query.Dump();

Outputs the following:

LINQPad Output 

That’s just the tip of the iceberg; if you’re iterating over a collection of objects, the grid will show you the public properties of each object in the collection:

LINQPad screen shot 

In fact, the only area where I’ve found LINQPad to be lacking is with extension methods. Because LINQPad “wraps” your code inside a wrapper class, and extension methods cannot be in an inner class. A hacky workaround that I’ve found is to set the “language” to “C# Program” and write your code like so:

void Main()
{
    string testString = "apple";
    
    testString.Pluralize().Dump();
}
}    // Add an extra closing bracket here

namespace System
{
    public static class MyExtensions
    {
        public static string Pluralize(this string str)
        {
            return str + "s";
        }
    }

// Don't close the namespace! LINQPad will do that when it adds the wrapper

LINQPad is still under active development, and you can submit feature requests if you think anything is missing.

The bottom line is that with AutoComplete enabled, LINQPad is king!

 Recent Posts

select to filter posts

Gamification: Coming to a workplace near you!

by Scott Johnston

Video games aren't just a wave of the future; they're the current reality for millions of players who take to their consoles and PCs every day.

read more

Managing Voter Experience

by Jim Ward

I had the chance to run a political campaign for a friend in the last civic election in Edmonton. A terrific experience, and full of surprises. But how could a computer guy possibly be qualified to run a campaign? If you’ve never been involved in one, ...

read more

Red Adair Rings True In IT

by Kerry Wiebe - Director of Business Development

“If you think it's expensive to hire a professional to do the job, wait until you hire an amateur.” - Red Adair This quote resonated with me when I recently took on a do-it-yourself (DIY) renovation project at my home. I decided to do the project ...

read more

My History with Umbraco

by Terence Jee

Umbraco is an open source, free CMS that allows users to download it and use for their own needs.

read more

Prototyping with Twitter Bootstrap

by Davis Levine

Front end frameworks can be powerful tools in a designer's development process. It can save a ton of time in the project process, and with most frameworks employing a fluid grid system, scaling to different devices becomes less of a headache.

read more

Knowledge of Possibilities

by Ammneh Azeim

Recently, I read a great blog post by Daniel Burrus which states “Give your customers the ability to do what they can’t currently do but would want to if they only knew it was possible.” The key here is knowledge of possibilities and knowledge which comes

read more

Safety Codes Council Adopts Microsoft Dynamics CRM

by Andrew Slessor

Recently, the Alberta Safety Codes Council adopted Microsoft Dynamics CRM as their platform for the Master Electrician Management System.

read more

Legal Aid Alberta Implements Microsoft Dynamics® CRM

by Andrew Slessor

Legal Aid Alberta Improves Client, Case and Financial Management with Microsoft Dynamics® CRM Legal Aid Alberta (LAA) provides cost-effective services to 200,000 Albertans in need each year.

read more

World Usability Day

by iomer

​​ This Thursday, November 7 is World Usability Day, a day dedicated to making the world a more user friendly place.

read more

PanEx 2011 Unites Developers and UX Professionals

by iomer

Last night I attended PanEx 2011 organized by UX YEG, Edmonton's User Experience community group.

read more

Committed to Disruption

by Jim Ward

​ One of the things I love about our industry is the counterintuitive truths that make themselves evident on a regular basis.

read more

SharePoint 2010 Data Access with LINQ to SharePoint

by Anthony Haxby

In SharePoint 2007 a popular and (relatively) straight-forward method of querying SharePoint Foundation data from lists was using the SPQuery class and involved writing the query using the Collaborative Application Markup Language (CAML).

read more

Case Study: Human Security Report Project

by iomer

The Human Security Report Project (HSRP) is an independent research centre affiliated with Simon Fraser University’s School for International Studies in Vancouver, Canada.

read more

Exciting new features in Dynamics CRM 2011

by Andrew Slessor

​​​​ We have been implementing Microsoft Dynamics CRM 2011 for a few months now and I am excited with many of the new features that have been added to the system.

read more

Bringing Teams Together: Calendar Overlays in SharePoint 2010

by iomer

Calendar aggregation is a topic that will come up time and time again when discussing desired functionality for a collaborative environment.

read more

An Opportunity to Pause

by Jim Ward

I was at the Microsoft Canadian Leadership Summit in Redmond last week. It's a great event for learning about future trends and technologies, as well as considering and applying the lessons presented by Microsoft experts and futurists.

read more

SQL Server Replication

by Mike Hebert - solution architect

Database replication is all about distributing data. There are many common scenarios where replication may make sense, whether it is to enable a mobile workforce, to allow intensive reporting or data mining without interfering with day-to-day operations,

read more

Stop Chasing Butterflies

by Jim Ward

Had some great learnings last week. Picture this. You've put your strategic plan together, and your team is busy doing the right things.

read more

The Coffee Still Matters

by Jim Ward - Founder

Former Starbucks CEO Howard Behar penned a wonderful book on leadership called “It’s Not about the Coffee”, based on his experiences building the Starbucks brand.

read more

Top Ten Reasons for Collaborative Governance

by Andrew Slessor

Collaborative Governance is the principal of sharing ownership of the intranet with various groups or individuals in an organization. Instead of no owner, or a single one, a collaborative team governs through the application of policies, standards and tem

read more

Website Sustainability

by iomer

​Website sustainability may sound like a complex topic but the concepts are quite straightforward and are fundamental to successful website development and growth.

read more

Diagnostic Logging

by Steven Sirockman - solution manager

As a SharePoint Technology Specialist, I have had many phone calls from clients asking me to come in and troubleshoot their SharePoint Server environment. One of the first questions I ask them is if they have configured diagnostic logging.

read more

Intranet Users Roles and Responsibilities

by Andrew Slessor

In order to manage a sucessful intranet, users must be certain of what tasks they are responsible for on the site. The roles for intranet users can be seperated into seven categories; these are described below.

read more

Snippet Compiler versus LINQPad

by Mike Hebert

Jeff Key’s Snippet Compiler is a popular developer tool that has been around for years – I first learned about it in a 2004 MSDN article titled “Ten Must-Have Tools Every Developer Should Download Now”.

read more

Dashboarding SQL Performance Counters

by Gord Barker - solution architect

In a previous blog I wrote about benchmarking SQL performance. This is important for those rare occasions when someone says the system is not running fast enough.

read more

3 Tools for Clearer, More Effective Writing

by Kael Nicholson

Need to convey a wealth of information in a tiny space? When working in the technical world, writers are constantly torn between the need to accurately describe complex ideas and the desire to make them clear and accessible.

read more

Integrating AJAX and Telerik with SharePoint

by Gord Barker

​To extend your SharePoint site to include Ajax, you will need to perform a few steps

read more

Logging SQL Performance Statistics

by Gord Barker - solution architect

One of the most important tools in analyzing a SQL Server performance problem is a good understanding of the normal behaviour your system exhibits.

read more

Five Things I'm Looking Forward to in SharePoint 2010

by iomer

Microsoft has released some Sneak Peek videos giving a preview of what we can expect to see in SharePoint 2010.

read more

SharePoint Application Performance

by iomer

Recently we were approached by a customer who was having performance issues with a custom application built on top of SharePoint.

read more

A Program to add files to a Zip file

by Gord Barker - solution architect

I recently had to retrieve 45 days worth of Air Quality data from a web site. I used WGET to retrieve 35000 tiny text files to a sub directory.

read more

The Top 10 SQL Scripts You Must Have

by Gord Barker - solution architect

Here is a collection of important SQL Script gathered from around the net (including the Steve and Chris Show on SSWUG). These are scripts you should know about or have in your toolkit.

read more

Edmonton Technology Community

by Christina Gray

As technology continues to advance, keeping up and prioritizing what you ‘need to know’ becomes more of a challenge.

read more