I was listening to the Brian Noyes episode of DotNetRocks today and one of his recommended essential tools was QuickCode.Net, a Visual Studio addin for code expansion.
Essentially, this works like a macro that pastes in simple code templates based on a pattern. Make sense ? No, I didn't think so.
One of the default templates looks for a pattern like prop [datatype] [propertyname] and expands it to a public property.
If I type :
prop int foo
and hit Alt + Q, it automagically turns it into : /// <summary>
/// Property Foo (int)
public int Foo
this.foo = value;
Another one is :
Turns into : /// <summary>
/// Class Yak
public class Yak
/// Default constructor
// TODO: insert constructor code here
Of course, my favourite code generation tool of all time CodeSmith does this and more, but it involves switching focus to a CodeSmith window, possibly loading a new template and running it. QuickCode does shorter, more commonly typed snippets with only a few keystrokes. At the grand total price of $30 a licence, a tool like this will pay for itself in no time at all. Awesome.
I have to agree with all the testimonials on their website, this thing rocks.