473,405 Members | 2,415 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,405 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 7106
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.