Dynamic reference to resource files in C#

Posted by Joda on Stack Overflow See other posts from Stack Overflow or by Joda
Published on 2008-08-27T10:12:08Z Indexed on 2010/05/20 21:40 UTC
Read the original article Hit count: 165

Filed under:
|

I have an application on which I am implementing localization.

I now need to dynamically reference a name in the resouce file.

assume I have a resource file called Login.resx, an a number of strings: foo="hello", bar="cruel" and baz="world"

normally, I will refer as: String result =Login.foo; and result=="hello";

my problem is, that at code time, I do not know if I want to refer to foo, bar or baz - I have a string that contains either "foo", "bar" or "baz".

I need something like:

Login["foo"];

Does anyone know if there is any way to dynamically reference a string in a resource file?

© Stack Overflow or respective owner

Related posts about c#

Related posts about localization