码迷,mamicode.com
首页 > Windows程序 > 详细

C#资源文件与与资源名称字符串之间的互相转化

时间:2015-03-11 21:08:40      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:

1.使用ResourceManager

string st = Properties.Resources.ResourceManager.GetString(tableName);
value = Properties.Resources.ResourceManager.GetObject(fileName, Properties.Resources.Culture);

 

2. 使用反射

var type = typeof(Properties.Resources);
var property = type.GetProperty(fileName, BindingFlags.Static| BindingFlags.NonPublic|BindingFlags.Public);
var value = property.GetValue(null, null);

C#资源文件与与资源名称字符串之间的互相转化

标签:

原文地址:http://www.cnblogs.com/xpvincent/p/4330703.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!