New CodeRush Plugin - Declare Extension Method

Another new CodeRush plugin!

This time one to help declare extension methods on existing objects.

Introducing Declare Extension Method

This plugin is really simple.

Consider the following code with a call to an undeclared method MyNewMethod.

DeclareExtensionMethodStart

Place your caret on the call to MyNewMethod and hit your CodeRush Refactor key (Defaults to Ctrl+`)

DeclareExtensionMethodMenu

Choose ‘Declare Extension Method’ from the menu.

DeclareExtensionMethodNewStaticClass

CodeRush generates a new static class in the same namespace as your calling code, containing the stub of your new extension method.

The previous syntax error will have disappeared and all that’s left to do, is for you to fill in the implementation of your new method Smile

Where do I get this Awesome Plugin from ?

Declare Extension Method is available from

GitHub: Here you will find the current (and historical) source of the plugin as well as the latest installable version.

The Visual Studio Gallery: Installing from the Visual Studio Gallery allows VS to locate any updates that are shipped after the initial release.

Well, I guess it would be nice

3 June, 2014

Please login or register to post comments.