You can use Visual Studio's Quick Actions (Light Bulb) feature to refactor your code. The following refactoring techniques are available - see the Related information.