为什么删除使用指令在C#中使用的? [英] Why remove unused using directives in C#?

查看:230
本文介绍了为什么删除使用指令在C#中使用的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否有任何原因(除了整理源$ C ​​$ C)为什么开发人员使用Visual Studio 2008中的删除未使用的 Usings 功能?

I'm wondering if there are any reasons (apart from tidying up source code) why developers use the "Remove Unused Usings" feature in Visual Studio 2008?

推荐答案

有你想带他们出去的几个原因。

There are a few reasons you'd want to take them out.

  • 这是毫无意义的。他们增加价值。
  • 这是令人困惑的。什么是从该命名空间中使用?
  • 如果你不这样做,那么你会逐渐积累无谓使用语句作为code随时间的变化。
  • 在静态分析是比较慢。
  • code编译比较慢。
  • It's pointless. They add no value.
  • It's confusing. What is being used from that namespace?
  • If you don't, then you'll gradually accumulate pointless using statements as your code changes over time.
  • Static analysis is slower.
  • Code compilation is slower.

在另一方面,不会有太多的理由离开他们。我想你保存自己不必删除他们的努力。但如果你是懒惰的,你有更大的问题!

On the other hand, there aren't many reasons to leave them in. I suppose you save yourself the effort of having to delete them. But if you're that lazy, you've got bigger problems!

这篇关于为什么删除使用指令在C#中使用的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆