One-click Code Cleanup in Visual Studio 2019

Microsoft introduced one-click code cleanup option to clean code in Visual Studio 2019. We can find one-click code cleanup option at bottom-left side of the visual studio IDE, as shown below.

By clicking on one-click cleanup option, code cleanup will get perform by executing the predefined rules set solution. “Remove unnecessary usings” and “Sort usings” options added to default rules set, so when we click on cleanup button, unused usings will get removed, and remaining usings will get arranged in sort order.

We can also edit the rules set by selecting the down arrow button and “Configure Code Cleanup” option, as shown below. 

It displays “Configure Code Cleanup” window as shown below. 

By default, “Remove unnecessary usings” and “Sort usings” options are included. You can add any option from “Available fixers” and can remove any option from “Include fixers”

We can also create different rules set by creating profiles. Profiles are handy if you want to apply the different sets of rules for different projects.