0

How can I put a resource resx file call into a string?
@ResCont is my namespace and cnBulgaria is a string inside the resource file.

I try this:

string enresources = "@ResCont.Resources";

Text = enresources.cnBulgaria, Value = "3"

The expected result: Text = @ResCont.Resources.cnBulgaria, Value = "3"

CMartins
  • 3,247
  • 5
  • 38
  • 53
  • Is that second line output or actual code? Either this isn't compilable to begin with, or you're leaving something out. – Broots Waymb Nov 14 '16 at 16:20
  • The bold text actually works. I just need to change @ResCont.Resources to a string since sometimes I use a different resource file. – CMartins Nov 14 '16 at 16:24
  • 1
    You can do something like this with `Properties` class. If `resx` is another file (not class generated for you by properties editor), then you have to use `ResourceManager`, unless you make it properties too (see [this](http://stackoverflow.com/a/26184562/1997232)). – Sinatr Nov 14 '16 at 16:34

0 Answers0