How to replace default interface property implementation expansion with automatic properties

By default, when you implement an interface in a class, you get the following for properties:

public string ClassName
{
    get
    {
        throw new NotImplementedException();
    }
    set
    {
        throw new NotImplementedException();
    }
}

But of course the typical thing to do is to implement them as automatic properties. You have two options at this point: modify the default expansion snippet, or do a find & replace with a regex.

How to change the default property stub expansion

Open the PropertyStub.snippet from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC#\Snippets\1033\Refactoring\PropertyStub.snippet, and change the <Code> from:...

Read full article

No Comments