I have two .resx
files: en.resx
and he.resx
, in the folder App_LocalResources
.
I already have two buttons in my web page, clicking each one is supposed to "switch" to the other language's resource file.
I want to simply get a string value located in one of the .resx
files.
I tried some of the examples I have found on google, and I asked myself, why do I need to provide an Assembly
type and a namespace, when i just want to ask for a string
value in my own project?
Why isn't there something like: string val = Resources["en.resx"]["SomeProperty"].Value
?
Maybe my whole approach is wrong, and I would like to read your opinions.
Thanks, Guy
using System.Resources;
ResXResourceSet Resource = new ResXResourceSet(HttpContext.Current.Server.MapPath(@"~/Properties/Resource.resx")
String value=Resource.GetStrin("key");