c#overplus name space增加页面上的负载?

时间:2013-07-17 04:46:39

标签: c# asp.net namespaces

在c#asp.net web表单上使用未使用的命名空间或win表单应用程序增加应用程序负载?我在实施完成时删除了未使用的

sample like this

2 个答案:

答案 0 :(得分:2)

简短的回答是 NO ,它不会增加“应用程序负载”

来自The C# Team's answers to frequently asked questions:

  

添加程序集引用或使用'using'关键字时,   csc.exe将忽略您实际未使用的任何程序集   在您的代码中。因此,如果您要设置引用   System.Data.dll和System.Windows.Forms.dll但只创作了   以下代码:

using System;
using System.Data;  // Ignored. 
using System.Windows.Forms; // Ignored. 

public class MyClass
{
  public static void Main()
  {
    Console.WriteLine("Hi there.");
  }
}
  

编译器只会引用必需的mscorlib.dll。

答案 1 :(得分:0)

代码中使用的命名空间数量对dot.net中的web或Windows应用程序的运行时性能没有任何影响,但是它会对编译时间产生一些影响,因为编译器必须搜索那些未使用的命名空间。