【发布时间】:2012-04-18 11:11:09
【问题描述】:
我有一个访问类库项目中文件的 Windows 应用程序。
public static class Global
{
private static ResourceManager ResourceManager { get; set; }
static Global ()
{
ResourceManager = new ResourceManager("MyClassLibraryProject.Resource", Assembly.GetExecutingAssembly());
}
private static string GetValue (string name)
{
return (ResourceManager.GetString(name, Options.CultureInfo));
}
public static string ProductName
{
get
{
return (GetValue(MethodBase.GetCurrentMethod().Name.Replace("get_", "")));
}
}
}
`
在此示例中,我手动创建了 ProductName 属性。有没有更简单的方法来访问资源文件中每一行的强类型名称?
【问题讨论】:
标签: c# embedded-resource strong-typing