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.


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.



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

The source code is available on GitHub.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.