I am working on a localised C#.NET application and we are using a strings.resx
file to translate hardcoded strings in the application. I use the following code to extract them:
using MyNamespace.Resources ... string someString = strings.someString;
But, now I want to be able to define the name of the string in the call, something like this:
string someString = GetString("someString");
I have been toying a little with the ResourceManager
, but i can't find a way to direct it to my strings.resx
file.
How do I do that?
A little searching did the trick. I have the right ResourceManager
available in my strings
class:
ResourceManager rm = strings.ResourceManager; string someString = rm.GetString("someString");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With