By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,836 Members | 1,725 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,836 IT Pros & Developers. It's quick & easy.

How to set a top-level namespace when you've defined a root namespace?

P: n/a
Hi,

I suspect that this isn't possible, but I figured I'd ask.

My project has a root namespace, let's say it's "Root", that applies to
almost every source file (which is why I've set it as the project's root
namespace).

However, the project also includes a couple of source files whose contents
will live in an entirely different namespace, let's say the "Special"
namespace.

So, within those particular source files, I use the Namespace statement:
Namespace Special

However, this puts the code into the namespace "Root.Special", not
"Special".

Does anyone know whether it's possible to use the Namespace statement to put
something into a top level namespace, NOT within the project's root
namespace?

Thanks,
Jeff Brown

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Jeff,
Does anyone know whether it's possible to use the Namespace statement to
put something into a top level namespace, NOT within the project's root
namespace? No, when you set the project's root namespace it is set for every file!

Have you considered moving the Special namespace into its own project? As it
sounds like it is outside the namespace of the current project.

However most of my solutions, the root of all projects share a common root.

For example, in my "My Application" solution, I might have:

Solution: My Application
Folder: My Application

Project: My App
Folder: My Application\My App
Namespace: MyApp
Assembly: MyApp.exe

Project: Framework
Folder: My Application\Framework
Namespace: MyApp.Framework
Assembly: MyApp.Framework.dll
Project: Plugin1
Folder: My Application\Plugin1
Namespace: MyApp.Plugin1
Assembly: MyApp.Plugin1.dll
Project: Plugin2
Folder: My Application\Plugin2
Namespace: MyApp.Plugin2
Assembly: MyApp.Plugin2.dll
Project: Data
Folder: My Application\Data
Namespace: MyApp.Data
Assembly: MyApp.Data.dll
Project: UI
Folder: My Application\UI
Namespace: MyApp.UI
Assembly: MyApp.UI.dll

Hope this helps
Jay
"Jeff Brown" <wo**************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... Hi,

I suspect that this isn't possible, but I figured I'd ask.

My project has a root namespace, let's say it's "Root", that applies to
almost every source file (which is why I've set it as the project's root
namespace).

However, the project also includes a couple of source files whose contents
will live in an entirely different namespace, let's say the "Special"
namespace.

So, within those particular source files, I use the Namespace statement:
Namespace Special

However, this puts the code into the namespace "Root.Special", not
"Special".

Does anyone know whether it's possible to use the Namespace statement to
put something into a top level namespace, NOT within the project's root
namespace?

Thanks,
Jeff Brown

Nov 21 '05 #2

P: n/a
Jeff,
Does anyone know whether it's possible to use the Namespace statement to
put something into a top level namespace, NOT within the project's root
namespace? No, when you set the project's root namespace it is set for every file!

Have you considered moving the Special namespace into its own project? As it
sounds like it is outside the namespace of the current project.

However most of my solutions, the root of all projects share a common root.

For example, in my "My Application" solution, I might have:

Solution: My Application
Folder: My Application

Project: My App
Folder: My Application\My App
Namespace: MyApp
Assembly: MyApp.exe

Project: Framework
Folder: My Application\Framework
Namespace: MyApp.Framework
Assembly: MyApp.Framework.dll
Project: Plugin1
Folder: My Application\Plugin1
Namespace: MyApp.Plugin1
Assembly: MyApp.Plugin1.dll
Project: Plugin2
Folder: My Application\Plugin2
Namespace: MyApp.Plugin2
Assembly: MyApp.Plugin2.dll
Project: Data
Folder: My Application\Data
Namespace: MyApp.Data
Assembly: MyApp.Data.dll
Project: UI
Folder: My Application\UI
Namespace: MyApp.UI
Assembly: MyApp.UI.dll

Hope this helps
Jay
"Jeff Brown" <wo**************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... Hi,

I suspect that this isn't possible, but I figured I'd ask.

My project has a root namespace, let's say it's "Root", that applies to
almost every source file (which is why I've set it as the project's root
namespace).

However, the project also includes a couple of source files whose contents
will live in an entirely different namespace, let's say the "Special"
namespace.

So, within those particular source files, I use the Namespace statement:
Namespace Special

However, this puts the code into the namespace "Root.Special", not
"Special".

Does anyone know whether it's possible to use the Namespace statement to
put something into a top level namespace, NOT within the project's root
namespace?

Thanks,
Jeff Brown

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.