Solved

get Root Namespace programatically

Posted on 2009-06-29
2
423 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
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 …
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 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