使用字符串获取资源 [英] Get Resources with string
本文介绍了使用字符串获取资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Resources文件夹中有很多txt文件.其中之一是corner.txt.我可以通过以下代码段访问此文件:
I have a lot of txt files in Resources folder. One of them is corner.txt. I can access this file via this code snippet:
Properties.Resources.corner
我将文件名保留在字符串变量中.例如:
I keep file names in string variables. For example:
string fileName = "corner.txt";
我想通过以下方式访问此文件:
Properties.Resources.fileName
这可能吗?我该如何访问?
Is this possible? How can I access?
推荐答案
我解决了以下代码段的问题:
I solved the problem this code snippet:
string st = Properties.Resources.ResourceManager.GetString(tableName);
因此,我不使用文件名,而是使用txt文件的字符串.这对我很有用.
So, I don't use the filename, I use the txt file's string. This is useful for me.
非常感谢.
这篇关于使用字符串获取资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文