【发布时间】:2019-03-15 09:43:38
【问题描述】:
我尝试获取 ressource.resx 的值,但我不能。
我愿意:
foreach (string certif in ContactCertifications)
{
Type calledType = Type.GetType("TestNamespace.Resources");
String s = (String)calledType.InvokeMember(certif,BindingFlags.InvokeMethod
| BindingFlags.Public |BindingFlags.Static,null,null,null); }
certif = "PRG_CARTV"
调用类型为:{Name = "Resources" FullName = "TestNamespace.Resources"} 当我在“String s = (String) calledType”行中时出现错误:“找不到方法'TestNamespace.Resources.PRG_CARTV'。”
当我有 String s = TestNamespace.Resources.PRG_CARTV; 时,它可以工作,所以我不理解..
当我做简单的事情时:
var myManager = new ResourceManager(typeof(Resources));
var myString = myManager.GetString("PRG_CARTV");
它不起作用,我有一个错误:“找不到指定文化或中性文化的适当资源。确保 \"TestNamespace.Ressources.resources \" 已正确嵌入或链接到程序集中.. 。”
【问题讨论】:
标签: c# resources resx invokemember