Convert to Procedure


This Code Provider is used to convert a function that returns a value of the appropriate type into a method that returns void. It is useful for instance when you have added a parameter passed into a method by reference and don’t need anything to be returned anymore.


Available when the caret is located on a non-void private method declaration. This method should have no references that use the returning value.


  1. Place the caret on a method’s name or type assuming that it returns a value of any type.


    The blinking cursor shows the caret’s position at which the Code Provider is available.

    private bool SayHello() {
        return true;
  2. Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
  3. Select Convert to Procedure from the menu.

After execution, the Code Provider changes the method’s return type to void and removes the returned values from all return statements.

private void SayHello() {

This Code Provider is the opposite of Convert to Function