JetBrains Rider
 
Get JetBrains Rider
You are viewing the documentation for an earlier version of JetBrains Rider.

Extract Method refactoring

Last modified: 23 May 2023

Refactor | Extract | Extract Method...

Ctrl+R, M

This refactoring allows you to create a new method or a local function based on the selected code fragment. JetBrains Rider analyses the selected statements and detects variables that can be converted into method parameters or represent its return value.

Consider the following example:

JetBrains Rider. Extract Method refactoring