开发者

Read values from resx files?

How to read strings from the MyResource.resx file from c#. I am not calling this from the asp.net pag开发者_如何学Goe, rather i am calling from my bussiness logic.

Assembly assembly = this.GetType().Assembly;

ResourceManager resourceManager = new ResourceManager("MessagesResource", assembly);

resourceManager.GetString("SCHEME_UNQ");

here i am getting exception,

Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MessagesResource.resources" was correctly embedded or linked into assembly "App_Web_eerdggo8" at compile time, or that all the satellite assemblies required are loadable and fully signed.

How can i fix this issue????


Once you add a resx file to your project, Visual Studio will automatically generate a designer class which allows you to read value (In the properties of the resx file you must have Custom Tool: ResXFileCodeGenerator). For example if you add Messages.resx to your project you could directly read values from it:

string value = Messages.SomeResourceKey;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜