Quantcast
Viewing all articles
Browse latest Browse all 2388

New CodeRush Plugin – CR_CorrectReturnType

In my previous post I was extolling the virtues of Convert to Function.

You’ll recall that it is used to alter the return type of the current function, from void to the value of the expression on the return statement at the caret.

Image may be NSFW.
Clik here to view.
MethodReturningIEnumerableInt

Well what if you have a pre-existing function which returns a string, and you need to alter the function to return an int.

Convert to Function is only available if the method is of type void. It is not available if the function returns anything else.

Enter CR_CorrectReturnType

My latest plugin, Correct Return Type provides the same functionality as Convert to Function, however it works where Convert to Function does not.

If the active function’s return type is non-void, and differs from that of the return statement at the caret, then Correct Return Type will become available instead of Convert to Function.

Image may be NSFW.
Clik here to view.
CorrectReturnType

Availability

As usual this plugin is available from both the Visual Studio Gallery and from GitHub.

The source code is available on GitHub.

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 2388

Trending Articles