title | description | ms.date | ms.topic | author | ms.author | manager | ms.subservice |
---|---|---|---|---|---|---|---|
Convert a local function to a method |
Learn how to use the Quick Actions and Refactorings menu to convert a local function to a method. |
02/19/2019 |
reference |
mikadumont |
midumont |
mijacobs |
general-ide |
This refactoring applies to:
- C#
What: Convert a local function to a method.
When: You have a local function that you want to define outside your current local context.
Why: You want to convert a local function into a method so that you can call it outside your local context. You might want to convert to a method when your local function is getting too long. When you define the function in a separate method, your code is easier to read.
-
Place your cursor in the local function.
-
Press Ctrl+. to trigger the Quick Actions and Refactorings menu.
-
Press Enter to accept the refactoring.