命名空间和子命名空间 [英] Namespace and Sub Namespaces

查看:183
本文介绍了命名空间和子命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用一个名称空间,然后让它自动地使用所有子命名空间的方法吗?

Is there a way to use a namespace and then have it automatically use all sub namespaces?

例如:

namespace Root.Account
{
//code goes here
}

namespace Root.Orders
{
//code goes here
}


//New File:
using Root;

为了让我使用Root.Account的code,我需要使用Root.Account到我的code以添加。

In order for me to use the code in Root.Account, I would need to add using Root.Account to my code.

我想能够只是说用root,并将它拿起任何子命名空间的类使用。

I would like to be able to just say using Root and have it pick up any sub namespace classes for use.

如果这是有道理的,这可能吗?

If this makes sense, is this possible?

感谢

推荐答案

没有,没有什么工作是这样的的树。不过,你不需要使用指令去的最多的树包括。换句话说,如果你使用:

No, there's nothing working that way down the tree. However, you don't need to include using directives to go up the tree. In other words, if you use:

namespace Root.Orders
{
    // Code
}

然后任何类型已经显现。

这篇关于命名空间和子命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆