
Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
That's an interesing point.
Will try to do this both ways.
> I am curious, why do you not have this stuff in a resource file? It
> makes more sense that way, since it seems like these are display strings
> (and this doesn't account for changes in the display string, as well as
> internationalization issues).
I have tried to do my task this way. The only problem is that i need to get
all string values from resource at one time. OF course when i need to access
one string value by it's name and i have this name its not problem while one
can use resourcemenager.
I would be grateful for any hint how to get all values at one time.
Andreas Mueller - 28 Aug 2006 12:24 GMT
>> I am curious, why do you not have this stuff in a resource file? It
>>makes more sense that way, since it seems like these are display strings
[quoted text clipped - 6 lines]
> can use resourcemenager.
> I would be grateful for any hint how to get all values at one time.
With this piece of code you can iterate ofer all enries in a resource file:
Assembly executingAssembly = typeof(ProgramCs20).Assembly;
// name of the resource file wihout extension
string stringTableName = "Resource1";
// Build resource name: DefaultNameSpace.FileName.resources
// Note: if you have sub folders in your project, you have to
// insert the folder names, too:
// DefaultNameSpace.Folder.SubFolder.FileName.resources
string resname =
string.Format("ConsoleApplication7.{0}.resources", stringTableName);
using (ResourceSet resSet =
new ResourceSet(executingAssembly.GetManifestResourceStream(resname)))
{
foreach (DictionaryEntry entry in resSet)
Console.WriteLine(string.Format("Key: {0}, Value: {1}",
entry.Key, entry.Value));
}
HTH,
Andy

Signature
You can email me directly by removing the NOSPAm below
xmenNOSPAm40@gmxNOSPAm.netNOSPAm
PiotrKolodziej - 28 Aug 2006 12:31 GMT
Wow.
Is it really the simplest way?
It isn't hard but doesn't look friendly too
:)
Piotr Kolodziej