Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在web.config文件中添加名称空间的优点是什么?_C#_Asp.net_.net_Namespaces_Web Config - Fatal编程技术网

C# 在web.config文件中添加名称空间的优点是什么?

C# 在web.config文件中添加名称空间的优点是什么?,c#,asp.net,.net,namespaces,web-config,C#,Asp.net,.net,Namespaces,Web Config,在web.config文件中添加名称空间有什么好处 <configuration> <system.web> <pages> <namespaces> <add namespace="System.Collections" /> </namespaces> &l

web.config
文件中添加名称空间有什么好处

<configuration>
     <system.web>
              <pages>
                <namespaces>
                  <add namespace="System.Collections" />
                </namespaces>
              </pages>
          </system.web>
</configuration>


这将允许添加视图中常用项的名称空间,以便在需要使用它们时不必在每个页面/视图中添加引用。

此处定义的名称空间将自动导入应用程序的所有页面。

它是否只影响网站项目,Web应用程序不是项目吗?这个名称空间是否也在c代码文件中自动调用?如果我们在web.config中添加了名称空间,那么就不需要使用
using
命令(例如:-
using System.Collections
)在代码文件中添加这些名称空间?