Solved

get Root Namespace programatically

Posted on 2009-06-29
2
400 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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