编程方式访问从资源文件中的值 [英] Access the value from resource file programmatically

查看:137
本文介绍了编程方式访问从资源文件中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

跨越,需要存储在资源文件中获取字符串值的基础上,从code后面提供的密钥的情况来了。

Came across a situation that requires accessing string value stored in resource file based on the key provided from code behind.

我怎样才能做到这一点?

how can i do this?

注意:资源文件存在于我的解决方案Web项目,我想从我的Silverlight应用程序访问。

Note: the resource file exist in a web project in my solution which i want to access from my silverlight application..

推荐答案

您可以使用<一个href=\"http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx\">ResourceManager类:

ResourceManager myManager = new ResourceManager(typeof(MyResource));
string myString = myManager.GetString("StringKey");

这篇关于编程方式访问从资源文件中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆