如何使用嵌套命名空间[帮助] [英] How To Use Nested Namespace [Help]

查看:61
本文介绍了如何使用嵌套命名空间[帮助]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想使用嵌套命名空间。


我有3个命名空间作为dll':

命名空间A

命名空间B

命名空间C


我希望有一些包含它们的命名空间,有点像


命名空间MyComp.ABC



命名空间MyComp.AB或Namespace BC等等......


(例如---> System.Data)


请帮助

解决方案

默认情况下,您的项目名称将成为根名称空间。您的程序集。

如果您使用的是VS.NET,只需右键单击解决方案中的项目

资源管理器,您将看到一个更改名称的选项根命名空间

那里。


要创建子命名空间,请完全按照下面的说法进行操作(记住

到结束每个命名空间):


命名空间A

命名空间B

命名空间C


公共类Foo

结束类


结束命名空间

结束命名空间

结束命名空间


所有3个命名空间都是根命名空间的一部分(默认情况下是项目名称,或者你在项目属性中更改了
)并且Foo位于命名空间中:


RootNamespace.ABCFoo


" Tiraman" < TI ***** @ netvision.net.il>在消息中写道

news:eU ************** @ TK2MSFTNGP09.phx.gbl ...


我想使用嵌套的命名空间。

我有3个命名空间作为dll':
命名空间A
命名空间B
命名空间C

我希望有一些包含它们的命名空间,有点像

命名空间MyComp.ABC
或者命名空间MyComp.AB或Namespace BC等等...

(例如---> System.Data)

请帮助



默认情况下,您的项目名称将成为根名称空间。您的程序集。

如果您使用的是VS.NET,只需右键单击解决方案中的项目

资源管理器,您将看到一个更改名称的选项根命名空间

那里。


要创建子命名空间,请完全按照下面的说法进行操作(记住

到结束每个命名空间):


命名空间A

命名空间B

命名空间C


公共类Foo

结束类


结束命名空间

结束命名空间

结束命名空间


所有3个命名空间都是根命名空间的一部分(默认情况下是项目名称,或者你在项目属性中更改了
)并且Foo位于命名空间中:


RootNamespace.ABCFoo


" Tiraman" < TI ***** @ netvision.net.il>在消息中写道

news:eU ************** @ TK2MSFTNGP09.phx.gbl ...


我想使用嵌套的命名空间。

我有3个命名空间作为dll':
命名空间A
命名空间B
命名空间C

我希望有一些包含它们的命名空间,有点像

命名空间MyComp.ABC
或者命名空间MyComp.AB或Namespace BC等等...

(例如---> System.Data)

请帮助



命名空间MyCompany.ABC {

class Foo {

}

}


给出一个名为MyCompany.ABCFoo的类

Tiraman < TI ***** @ netvision.net.il>在消息中写道

news:eU ************** @ TK2MSFTNGP09.phx.gbl ...


我想使用嵌套的命名空间。

我有3个命名空间作为dll':
命名空间A
命名空间B
命名空间C

我希望有一些包含它们的命名空间,有点像

命名空间MyComp.ABC
或者命名空间MyComp.AB或Namespace BC等等...

(例如---> System.Data)

请帮助



Hi ,

I would like to use nested namespace .

I have 3 namespace as dll''s :
Namespace A
Namespace B
Namespace C

And i want to have some namespace that contain them all , some thing like

Namespace MyComp.A.B.C
Or
Namespace MyComp.A.B or Namespace B.C And so on ...

(e.g ---> System.Data)

please help

解决方案

By default, your project name becomes the "root namespace" of your assembly.
If you are using VS.NET, just right click on the project in the Solution
Explorer and you''ll see an option to change the name of the Root Namespace
there.

To create sub-namespaces, do exactly what you wrote down below (remembering
to end each namespace):

Namespace A
Namespace B
Namespace C

Public Class Foo
End Class

End Namespace
End Namespace
End Namespace

All 3 namespaces are part of the root namespace (project name by default or
you change in project properties) and Foo is in the namespace:

RootNamespace.A.B.C.Foo

"Tiraman" <ti*****@netvision.net.il> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...

Hi ,

I would like to use nested namespace .

I have 3 namespace as dll''s :
Namespace A
Namespace B
Namespace C

And i want to have some namespace that contain them all , some thing like

Namespace MyComp.A.B.C
Or
Namespace MyComp.A.B or Namespace B.C And so on ...

(e.g ---> System.Data)

please help



By default, your project name becomes the "root namespace" of your assembly.
If you are using VS.NET, just right click on the project in the Solution
Explorer and you''ll see an option to change the name of the Root Namespace
there.

To create sub-namespaces, do exactly what you wrote down below (remembering
to end each namespace):

Namespace A
Namespace B
Namespace C

Public Class Foo
End Class

End Namespace
End Namespace
End Namespace

All 3 namespaces are part of the root namespace (project name by default or
you change in project properties) and Foo is in the namespace:

RootNamespace.A.B.C.Foo

"Tiraman" <ti*****@netvision.net.il> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...

Hi ,

I would like to use nested namespace .

I have 3 namespace as dll''s :
Namespace A
Namespace B
Namespace C

And i want to have some namespace that contain them all , some thing like

Namespace MyComp.A.B.C
Or
Namespace MyComp.A.B or Namespace B.C And so on ...

(e.g ---> System.Data)

please help



namespace MyCompany.A.B.C {
class Foo {
}
}

Gives a class called MyCompany.A.B.C.Foo
"Tiraman" <ti*****@netvision.net.il> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...

Hi ,

I would like to use nested namespace .

I have 3 namespace as dll''s :
Namespace A
Namespace B
Namespace C

And i want to have some namespace that contain them all , some thing like

Namespace MyComp.A.B.C
Or
Namespace MyComp.A.B or Namespace B.C And so on ...

(e.g ---> System.Data)

please help



这篇关于如何使用嵌套命名空间[帮助]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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