【问题标题】:Does Adding more namespace in the code file affect performace?在代码文件中添加更多命名空间会影响性能吗?
【发布时间】:2011-02-25 20:41:21
【问题描述】:

如果我们在代码文件(cs 文件)中导入更多的命名空间,那么它会影响性能吗?就像我们应该根据需要在 cs 文件中添加命名空间一样。那是在 cs 文件中添加更多命名空间会影响性能吗?喜欢

using System;
using System.Data.Sql;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;
using System.Data.SqlClient;
using System.ComponentModel;

【问题讨论】:

    标签: c# winforms performance namespaces


    【解决方案1】:

    完全不会影响您的表现

    一切都在需要时加载。因此,如果您有一些从未使用过的语句,它不会损害您的应用程序的性能。

    为了代码的清晰和可读性,大部分未使用的语句都会被清理。

    【讨论】:

      【解决方案2】:

      它不影响性能。但是为了代码的整洁,我建议删除特定类文件中不需要的 using 语句。这很简单,只需在 IDE 中右键单击并转到 Organize Usings。

      【讨论】:

        【解决方案3】:

        不,它不会影响性能。 因为它仅供编译器使用。

        【讨论】:

          猜你喜欢
          • 2011-05-21
          • 2016-06-06
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-11-28
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多