简体   繁体   中英

How to define ResourceManage in C#

I have one mvc project with resource file, this's name space in auto-generated file Designer.cs : namespace eWarranty.Languages

In my source code, I create new ResourceManager :

var resourceManager = new System.Resources.ResourceManager("eWarranty.Languages", System.Reflection.Assembly.GetExecutingAssembly());

But I get this error: Additional information: Could not find any resources appropriate for the specified culture or the neutral culture.

I think my ResourceManager incorrect. How to define a wright instance of ResourceManager ?

You have to include the class of the resources when instantiating the ResourceManager.

Use

"eWarranty.Languages.Resources"

This is assuming the namespace is "eWarrenty.Languages" and the type name of the compiled resources is "Resources".

Hope this helps,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM