c# - 从 resx 文件中读取字符串 sharpdevelop c#

标签 c# resx sharpdevelop

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

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

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

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.

问题是Sharpdevelop中不能使用resx文件吗??如果是,那么如何解决这个问题。

感谢和问候,
瓦米普

最佳答案

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

 Assembly.GetExecutingAssembly()

关于c# - 从 resx 文件中读取字符串 sharpdevelop c#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3317727/

相关文章:

IronPython 和实例化 COM 对象

c# - 对 Silverlight 类库的引用

c# - 如何读取此二进制转换为整数?

javascript - 跨域SignalR导入问题

c# - 以不同的语言运行我的 C# 应用程序

c# - CultureInfo 和 (resx) 资源文件

c# - 从 XAML 中的 *.resx 文件获取值

c# - 如何在 DataTemplate 的 DataType 属性中引用泛型类型?

c# - 使用 File.AppendAllText 导致 "Process cannot access the file, already in use"错误

sharpdevelop - Foreach 循环 VB.Net 到 C# 代码转换