I'm trying to get a list of strings out of a ResourceManager with the names of all the resources.
It contains icons only.
I'm using .NET 2.0 Beta 2 and writing it in C# .
Anybody who have an idea?
-
-
In the .NET Framework v2.0 you can use a class called ResourceSet in the System.Resources namespace. You new up a ResourceSet providing the Resource File Name in the constructor then you have access to the resources by enumerating through the ResourceSet.
Some sample code off the top of my head...
public void GetResources()
{
ResourceSet resources =
new ResourceSet("theresourcefile.resources");
//enumerate through the ResourceSet
IDictionaryEnumerator enumerator =
resources.GetEnumerator();
while(enumerator.MoveNext())
{
Console.WriteLine(enumerator.Key);
}
}
This is one approach to reading ALL the Resource Keys available! -
Thanks, now how do I get them add into a String[] ? (Somehow I cannot get ArrayList to accept Generics, so I cannot just put the key into there and run toArray on it).
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.