从 resx 文件中读取字符串 Sharpdevelop C#

发布于 2024-09-11 10:49:21 字数 502 浏览 2 评论 0原文

我正在使用 Sharp Development 用 C# 编写一个类库。我包括一个 resx(resource) 文件,其中包含一些字符串值。我正在使用以下代码:

ResourceManager rm = new ResourceManager("ResourceFileName",this.GetType().Assembly);
string str=rm.GetString("Keyname");

它编译得很好。在运行时,它给我以下错误:

找不到任何资源 适合特定文化 或中立文化。确保 “ResourceFileName.resources”是 正确嵌入或链接到 编译时的程序集“myassemble”, 或者所有卫星组件 所需的可加载且完全 已签署。

问题是Sharpdevelop中是否无法使用resx文件?如果是,那么如何解决这个问题。

谢谢和问候,
瓦米普

I'm writing a class library in C# using sharp develop. I am including an resx(resource) file which contains some string values. I'm using the following code:

ResourceManager rm = new ResourceManager("ResourceFileName",this.GetType().Assembly);
string str=rm.GetString("Keyname");

It compiles fine. At run time, it gives me the following error:

Could not find any resources
appropriate for the specified culture
or the neutral culture. Make sure
"ResourceFileName.resources" was
correctly embedded or linked into
assembly "myassembly" at compile time,
or that all the satellite assemblies
required are loadable and fully
signed.

The question is that is it not possible to use resx file in Sharpdevelop?? If yes, then how to resolve this problem.

Thanks and Regards,
Vamyip

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

各自安好 2024-09-18 10:49:21

在第一个参数中使用资源类的全名“namespace.classname”
在第二个参数中

 Assembly.GetExecutingAssembly()

In the first argument use full name of resource class "namespace.classname"
in secound argument

 Assembly.GetExecutingAssembly()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文