ReSharper 8.0 Web Help

The Transform Out Parameters refactoring lets you get rid of out parameters in methods and consequently improves readability of your code.

To transform out parameters
  1. Place the caret at the name of a method, at the out keyword or at the name of an out parameter in the editor or select the method in the File Structure window.
  2. Do one of the following:
    • On the main menu, choose ReSharper | Refactor | Transform Out Parameters.
    • Right-click, then click Refactor | Transform Out Parameters on the context menu.
    • Press Ctrl+Shift+RCtrl+Shift+R, then click Transform Out Parameters.
  3. The Transform Out Parameters dialog box opens:

    Refactorings__Transform_Out_Parameters

    Select the appropriate check boxes nearby the parameters. According to the selected check boxes, a new signature is displayed in the Transform to text area.
  4. Click Next.

After applying the refactoring two kinds of results are possible:

  • If the return type of a method is void and only one out parameter is being transformed, ReSharper changes the method so that it simply returns the value of this parameter.
  • If the return type of a method is not void or more than one out parameter are being transformed, ReSharper uses the Tuple type.

Note

Pay attention, that in projects targeting .NET Framework 3.5 or lower this refactoring is available only for methods with a void return type.


This feature is supported in the following languages/technologies:

C# VB.NET HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts
feature_available feature_available

Tip

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.

See Also

Procedures: