Feature request: Generate extension method stubs

ReSharper is superb for Test-Driven Development, with the code-first approach and tools for generating code. However, it's not possible to generate code for extension methods. Usually I will type this:

if (number.IsEven())

In this case, ReSharper cannot help me generate the IsEven() extension method. What I have to do is change it to

if (IsEven(number))

and then let ReSharper generate the IsEven() method, and then move the IsEven() method to a public static class and then change its signature to turn it into an extension method. I think ReSharper should do this for me, as it is essential for TDD.

I would like alt-enter on a non-existing extension method to, for example,

  1. Find all the current public static classes in my solution
  2. Let me choose one
  3. Generate the method as an extension method in that class

In the example above, there is no "generate method" action, since ReSharper knows it cannot modify System.Int32. This means the only possible option is an extension method!

I'm sure you can get this into ReSharper 5.

Best regards from your most loyal customer!

Please sign in to leave a comment.