简体   繁体   English

有没有快速的方法来删除C#中的语句?

[英]Is there a quick way to remove using statements in C#?

Is there a quick way to determine whether you are using certain namespaces in your application. 有没有快速的方法来确定您是否在应用程序中使用某些名称空间。 I want to remove all the unneccessary using statements like using System.Reflection and so on, but I need a way to determine if I am using those libraries or not. 我想删除所有不必要的使用语句,如使用System.Reflection等,但我需要一种方法来确定我是否使用这些库。 I know that the tool Resharper does this for you, but is there a quick and dirty and Free way to do this? 我知道Resharper工具为你做了这个,但有一个快速,肮脏和自由的方式来做到这一点?

Visual Studio 2008也将为您执行此操作,右键单击您的类文件并选择“组织使用” - >“删除并排序”。

Visual Studio 2008 + PowerCommmands =在整个解决方案中删除和排序使用。

VS2008 can do this on a per-file basis. VS2008可以基于每个文件执行此操作。

Right-click the source code, select "Organize Usings", "Remove Unused Usings". 右键单击源代码,选择“组织使用”,“删除未使用的使用”。

我刚注意到你的vs2008标签,但是对于那些没有VS2008的人来说,你可以在Resharper中获得类似的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM