.net - 冗余命名空间会产生任何开销吗

标签 .net language-features

除了维护复杂性(我认为几乎没有)之外,而且它不是一个干净的解决方案(我同意这一点)这一事实确实在 .NET 类中导入冗余命名空间会产生任何开销内存/空间/等等?

例如,如果我导入 My.Namespace 但不调用其任何功能,那么 Visual Studio 编译器是否足够智能,不会在部署我的应用程序时打包相应的二进制文件? p>

最佳答案

来自C# FAQ :

When you add assembly references or make use of the 'using' keyword, csc.exe will ignore any assembly which you have not actually made use of in your code.

有 2 个与此相关的问题:

  1. Why should you remove unnecessary C# using directives?

  2. overhead to unused “using” declarations ?

关于.net - 冗余命名空间会产生任何开销吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1178598/

相关文章:

c# - Windows 上 Git 的持续集成

c# - 如何在客户端和服务器端设置jsonp

c# - 是否可以使用 Windows 应用程序打包项目打包两个 UWP 应用程序?

c - C宏有什么用?

objective-c - 我应该在实现中使用 self 关键字(属性)吗?

go - 为什么 Go 常量中不允许使用 `math.Sin`?

javascript - var something = somethingElse.obj = somethingElse.obj || {} - 这是做什么用的?

c# - 具有相同元素的两个列表不相等。为什么?

.net - 为什么 ServiceStack.Text 不默认日期为 iso8601?

ruby - 为什么 Haskell 没有符号(像 ruby​​)/原子(像 erlang)?