473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Default Project Namespace

How do I get the default namespace of the project programatically ?

For example, the following code loads the embedded resource in the assembly
and "MyNS" is the default namespace.

assembly.GetManifestResourceStream("MyNS.Test.Rtf" );

I do not want to hardcode it. I wish to have something like this:

assembly.GetManifestResourceStream(GetDefaultNameS pace()+".Test.Rtf");

Thanks.
Nov 16 '05 #1
3 7104
The default namespace is just a VS.NET project setting for convenience. It
has no meaning in the .NET framework.

You probably need to get the currently executing assembly, and use its name.

"Tank" <an*******@discussions.microsoft.com> wrote in message
news:uj**************@TK2MSFTNGP09.phx.gbl...
How do I get the default namespace of the project programatically ?

For example, the following code loads the embedded resource in the assembly and "MyNS" is the default namespace.

assembly.GetManifestResourceStream("MyNS.Test.Rtf" );

I do not want to hardcode it. I wish to have something like this:

assembly.GetManifestResourceStream(GetDefaultNameS pace()+".Test.Rtf");

Thanks.

Nov 16 '05 #2
Tank <an*******@discussions.microsoft.com> wrote:
How do I get the default namespace of the project programatically ?

For example, the following code loads the embedded resource in the assembly
and "MyNS" is the default namespace.

assembly.GetManifestResourceStream("MyNS.Test.Rtf" );

I do not want to hardcode it. I wish to have something like this:

assembly.GetManifestResourceStream(GetDefaultNameS pace()+".Test.Rtf");


The default project namespace is a VS.NET concept, not a .NET framework
concept. You could find the namespace of the current type though, if
you wanted.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3
Tank,

I am sure you mean you want to get the current namespace as it is defined in
the top of your class, this is automatically set from your default namespace
setting within the project each time you add a class. Look at the
MethodBase object for getting current information about your class or exe.

HTH,

Matt

"Tank" <an*******@discussions.microsoft.com> wrote in message
news:uj**************@TK2MSFTNGP09.phx.gbl...
How do I get the default namespace of the project programatically ?

For example, the following code loads the embedded resource in the assembly and "MyNS" is the default namespace.

assembly.GetManifestResourceStream("MyNS.Test.Rtf" );

I do not want to hardcode it. I wish to have something like this:

assembly.GetManifestResourceStream(GetDefaultNameS pace()+".Test.Rtf");

Thanks.

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tank | last post by:
How do I get the default namespace of aproject programatically ? The idea is to not hardcode the default namespace when accessing embedded resources in the project. For example, ...
1
by: Patrick Blackman | last post by:
How do you determine the default namespace of a project using code?
3
by: Edward Diener | last post by:
In the explanation to the ToolboxBitmapAttribute it is mentioned that new bitmaps added to an assembly by Visual Studio .NET get the name of the default namespace prepened to the name of the...
0
by: Q. John Chen | last post by:
I have a ASP.NET web project. I made the default namespace for the project "myns" and the ide automatically append the folder name into the namespace for a reason. I can live with this by simply...
0
by: Bob | last post by:
I'm a few hours into VS 2005 beta and it looks pretty good. I was able to follow the MSDN article about ASP.NET 2.0 master page and created a couple of pages based on a master page. Now I...
4
by: jj | last post by:
I have an Assembly object that I need to get a resource stream from. The name of the resource is of course based upon the default namespace, not the assembly name. Is there a way to use reflection...
2
by: shumaker | last post by:
I'm confused about the default namespace setting in the project properties. Help has the following: "Default namespace Specifies the base namespace for all files in the project. For example,...
1
by: =?Utf-8?B?U2hhcm9u?= | last post by:
How can I get the default namespace of my executable assembly at runtime? -- Thanks Sharon
10
by: Brad Baker | last post by:
I have an asp.net/csharp application that requires a particular variable to work properly. This variable is usually passed via a query string in the URL when the application is first run but under...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.