Have ReSharper keep 'using System;' when optimizing usings

会有一股神秘感。 提交于 2019-12-05 13:28:41

问题


I was wondering if there is some option to keep ReSharper from removing just the using System; directive? Perhaps this is configurable somewhere?

Also, is there a way to have ReSharper sort the remaining directives just as Visual Studio 2008 does it (alphabetically, I think)?

Thanks.


回答1:


Yes, there is such an option: ReSharper->Languages->C#->Namespace Imports. You can add namespaces,that should not be removed, as well as namespaces, that should always be imported.




回答2:


Yes, in the options (Resharper > Options > Languages > C#), there is a Namespace Imports section that allows you to specify namespaces that should never be removed. You would put System into the prompt it gives.



来源:https://stackoverflow.com/questions/356010/have-resharper-keep-using-system-when-optimizing-usings

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