如果“使用”是内部空间还是外部?内部空间

2023-09-05 00:09:19 作者:残梦▌ Dangerou

可能重复:   Should Usings的内部或命名空间外

是否有任何技术原因preferring这种

 命名空间富
{
     使用系统;
     使用System.IO;
 

而不是默认的

 使用系统;
使用System.IO;

命名空间富
{
 

解决方案

埃里克利珀的解释了这一。

简约气质的空间诗意

在一般情况下,他们是相同的。 然而,使用命名空间中的语句可以看到的命名空间和别名包括命名空间之外。

Possible Duplicate: Should Usings be inside or outside the namespace

Are there any technical reasons for preferring this

namespace Foo
{
     using System;
     using System.IO;

instead of the default

using System;
using System.IO;

namespace Foo
{

解决方案

Eric Lippert explains this.

In general, they're identical. However, using statements in the namespace can see namespaces and aliases included outside the namespace.

相关推荐