tradez tradez - 8 months ago 36
C# Question

Can I call an entry in a resource file using a method or variable?

I have several resource files built for a multilingual MVC 5 site I am working on.

I am using a CMS and the user can select the button text on certain content segments, like "Download" or "View More".

Rendering a value from my resource file using

in my view works fine, but since the content is dynamic depending on what button text the user selects in the CMS, I need to use something like
but obviously that will not work.

Any suggestions on how to handle this?


You can use ResourceManager class for this

    ResourceManager rm = new ResourceManager(typeof(Resources.Resource));