Solved

get Root Namespace programatically

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now