The .NET team is constantly thinking of new ways to make developers more productive. We’ve been working hard over the past year to take the feedback you’ve sent us and turn it into tools that you want! In this post I’ll cover some of the latest productivity features available in Visual Studio 2019 Preview.
Code Fixes and Refactorings
Code fixes and refactorings are the code suggestions the compiler provides through the lightbulb and screwdriver icons. To trigger the Quick Actions and Refactorings menu type (Ctrl + .) or (Alt + Enter). The list below contains the code fixes and refactorings that are new in Visual Studio 2019 Preview. We’d like to give a big thanks to the community for implementing and reviewing many of these!
Rename a file when renaming a class
You can now rename a file when renaming an interface, enum or class.

Sort usings is back!
We brought back the sort usings command separate from the Remove and Sort Usings command. You can now find the Sort Usings command in Edit > IntelliSense.

Convert a switch statement to a switch expression
You can now convert a switch statement to a switch expression. In your project file make sure the language version is set to preview since switch expressions are a new C# 8.0 feature.

Toggle comment/uncomment
Toggle single line comment/uncomment is now available through the keyboard shortcut (Ctrl + K, /). This command will add or remove a single line comment depending on whether your selection is already commented.
Toggle block comment/uncomment is now available through the keyboard shortcut (Ctrl + Shift + /). This command will add or remove block comments depending on what you have selected.


Wrap binary expressions
We now have a code fix for wrap binary expressions.

Get Involved
This was just a sneak peak of what’s new in Visual Studio 2019 Preview, for a complete list see the release notes and feel free to provide feedback on Developer Community, and using the Report a Problem tool in Visual Studio.




Thank you for this update. I have one question regarding the “Sort Usings” feature. At this moment “sort usings” just sort them alphabetically. Is there a way to customize the default behaviour of “sort using”? In my projects I’d like to sort usings in the following order: 1. System.* 2. Microsoft.* 3. 3rd party. 4. This solution/project. Usings within each group are being sorted alphabetically.
1. I think it’s great that you add new refactorings! 🙂
2. I think it’s a pity that you decided not to fix existing refactorings. 🙁
Thanks to VS dev team to include all of these useful features 🥰
Soon we don’t required Resharper to code in C# easily (refactoring, autocompletion, etc…)😋
Is there a command line tool for code fixes and things like sorting usings?
There is a command-ine tool that applies coding styles specified in editorconfig: https://github.com/dotnet/format/wiki/Supported-.editorconfig-options
Unfortuantely, sort usings is not yet one of the styles included in the dotnet-format tool, but it has been requested: https://github.com/dotnet/format/issues/40 If you could upvote that issue, share your thoughts, and follow for updates it would help us prioritize. Thank you!