Getting List of Strings

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Say I have a Resources file I created, I.e., Add > New Item... > Resources
File

In this file, I have specified a varied of Name / Value pairs.

Now, in my code, I want to be able to 'get' a list of the Names, and perhaps
also the list of the associated Values... how might I accomplish this in c#?

TIA-
 
Thanks for the pointer!

It goes something like this:

System.Reflection.Assembly a =
System.Reflection.Assembly.GetExecutingAssembly();

System.IO.Stream s =
a.GetManifestResourceStream("MyNamespace.MyResourceName.resources");

System.Resources.ResourceReader rr = new
System.Resources.ResourceReader(s);
System.Collections.IDictionaryEnumerator en =
rr.GetEnumerator();

while(en.MoveNext())
{
Debug.WriteLine(en.Key);
Debug.WriteLine(en.Value);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top