In Visual Studio 2019 how can I remove unused usings on format document?

自古美人都是妖i 提交于 2019-12-10 12:29:01

问题


In Visual Studio 2019 how can I remove unused usings on format document?

I have found instructions for previous versions of Visual Studio (Go to Tools > Options > Text Editor > C# > Code Style > Formatting.). I don't see that in Visual Studio 2019.


回答1:


In Visual Studio 2019 you can remove unused usings with the Code Cleanup command:

And running code cleanup also formats the document.




回答2:


CTRL + K + E Will sort and remove your unused usings.




回答3:


You can assign both functions to Ctrl + K, Ctrl + D by changing hotkeys and keyboard shortcuts



来源:https://stackoverflow.com/questions/55615136/in-visual-studio-2019-how-can-i-remove-unused-usings-on-format-document

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!