Solved

get Root Namespace programatically

Posted on 2009-06-29
2
409 Views
Last Modified: 2012-05-07
How can I get the Root Namespace programatically of my assembly?

I'm trying to use a Resource Manager object to get localized string from a resource file, but I have to specify the root namespace in the constructor of the Resource manager.  
0
Comment
Question by:OFGemini
2 Comments
 
LVL 39

Accepted Solution

by:
abel earned 500 total points
ID: 24737463
I assume you mean "root type" or "root assembly". The resource manager does not need a reference to the root namespace, instead, it needs a reference to a Type that it can use to locate the *.resources file inside the loaded assembly. In other words, it depends on what typename you used to "bind" the resource to the type and that Type is the one you should use in the constructor.

However, if you have a Resources.resx file in your WinForms application, it is actually much easier to let Visual Studio take care of everything for you. Simply use the following statement to get something from your resources:

Bitmap myPicture = Properties.Resources.MyPicture1;
Or use the following to get the ResourceManager that is currently associated to your default resources:

ResourceManager resMgr = Properties.Resources.ResourceManager;
-- Abel --

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question