473,396 Members | 2,024 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,396 software developers and data experts.

foreach string resourceKey in ResourceManager?

Is there any way I can get all resource keys with in a compiled and
embedded resx file?
Thanks!

Sep 1 '07 #1
1 7305
"deerchao" <de******@gmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
Is there any way I can get all resource keys with in a compiled and
embedded resx file?
Thanks!
This can be done by enumerating the keys of the underlying ResourceSet. See
below for a sample function (C# 2.0 and later).

private IEnumerable<stringGetResourceNames(string name)
{
return GetResourceNames(name, Assembly.GetExecutingAssembly());
}

private IEnumerable<stringGetResourceNames(string name, Assembly assembly)
{
ResourceManager rm = new ResourceManager(name, assembly);
ResourceSet rs = rm.GetResourceSet(CultureInfo.CurrentUICulture, true,
true);

IDictionaryEnumerator ide = rs.GetEnumerator();

while (ide.MoveNext())
{
yield return (string)ide.Key;
}
}

Sample code:
foreach (string key in GetResourceNames("RD.Properties.Resources")) // This
is the fully qualified name of the resource set
{
// Do something with key...
}

Best Regards,
Stanimir Stoyanov
www.stoyanoff.info | www.aeroxp.org

Sep 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nils Erik Asmundvaag | last post by:
Hello I hope someone is able to help me with this frustrating problem. I have a C# web project in Visual Studio .NET 2003. I want to support Swedish and Norwegian texts and have put the texts...
0
by: the_medeiros | last post by:
How i can use resources files to show display messages ??? I try use: private static ResourceManager resourceManager = new ResourceManager(typeof(ExceptionManager).Namespace +...
1
by: Sreekanth | last post by:
Hi, I am trying to globalize my application by separating out all the strings into resource files. For testing purpose, I have created two resource files. MyApp.resx, MyApp.en-US.resx. These resx...
16
by: Islam Elkhayat | last post by:
In my web application i use satalite assembly to localize my web form.. Instead of set the each control text to the resourcemanager getstring() method i try to use foreach loop private string...
1
by: luciano.marchese | last post by:
I just want to get at runtime meta:resourcekey value. This is my code: <asp:Button ID="Button1" runat="server" meta:resourcekey="Button1Resource1" Text="Button" /> The problem is that it's not...
1
by: Franz | last post by:
I know how to use ResourceManager, but I think I don't use it wisely. I have a web user control. Inside the control, I need to call ResourceManager.GetString. However, I also need to call...
0
by: Kurtis | last post by:
G'Day, I'm in the process of developing a custom ResourceProvider for an ASP.Net web application written in C# 2.0, which uses SQL server as the data store. I'm half way there! After setting the...
3
by: groovyjman21 | last post by:
Hi all, Can someone just give me a dead-simple example of how to find, read, and use resource files from C# using the VS2005 IDE? I need to call some strings from a resource file and am having...
4
by: Peter Larsen [] | last post by:
Hi, How do i read a resource string from a dll in code ?? BR Peter
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.