Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in C Sharp only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Member List
Calendar
Today's Posts
Home
Forum
Topic
C Sharp
foreach string resourceKey in ResourceManager?
foreach string resourceKey in ResourceManager?
Collapse
This topic is closed.
X
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
deerchao
#1
foreach string resourceKey in ResourceManager?
Sep 1 '07, 09:45 AM
Is there any way I can get all resource keys with in a compiled and
embedded resx file?
Thanks!
Stanimir Stoyanov
#2
Sep 1 '07, 10:35 AM
Re: foreach string resourceKey in ResourceManager ?
"deerchao" <deerchao@gmail .comwrote in message
news:1188639542 .178438.219060@ 22g2000hsm.goog legroups.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<str ingGetResourceN ames(string name)
{
return GetResourceName s(name, Assembly.GetExe cutingAssembly( ));
}
private IEnumerable<str ingGetResourceN ames(string name, Assembly assembly)
{
ResourceManager rm = new ResourceManager (name, assembly);
ResourceSet rs = rm.GetResourceS et(CultureInfo. CurrentUICultur e, true,
true);
IDictionaryEnum erator ide = rs.GetEnumerato r();
while (ide.MoveNext() )
{
yield return (string)ide.Key ;
}
}
Sample code:
foreach (string key in GetResourceName s("RD.Propertie s.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
Comment
Post
Cancel
Previous
template
Next
Working...
OK
OK
Cancel
👍
👎
☕
Comment