Convert to Function

Converts a method that returns void, into a function that returns a value of the appropriate type. Selects the reference to the returned value type, and drops a marker onto the initial return keyword.


From the context menus or via shortcuts:

  • when the edit cursor or caret is on the return keyword, provided that the method returns void.


This code provider is the opposite of Convert to Procedure.


public void TestMethod()
{return 10;
Public Sub TestMethod()Return 10
End Sub


public int TestMethod()
    return 10;
Public Function TestMethod() As Integer
    Return 10
End Function