从DLL文件中读取资源 [英] Read resources from a DLL file

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

问题描述

我有两个Visual Basic 2008项目 - 一个是类库项目,另一个是Windows窗体项目。在类库项目中,我定义的项目资源某些字符串(项目属性>资源标签)。

I've two Visual Basic 2008 projects - one is a class library project and another is a Windows Forms project. In the class library project, I've defined some strings in the project resources (project properties > Resources tab).

我建立一个类库项目,并得到DLL文件从debug文件夹,并添加了在我的Windows窗体项目的引用。

I build that class library project and get the DLL file from the debug folder and added up as a reference in my Windows Forms project.

我如何读取从引用的DLL文件,这些字符串?

How do I read those strings from the referenced DLL file?

推荐答案

我觉得你只是使用 System.Reflection.Assembly.Load 加载其他装配,然后使用 System.Resources.ResourceManager 接受一个集

I think you just use System.Reflection.Assembly.Load to load the other assembly then use the constructor of System.Resources.ResourceManager that takes an assembly.

下面,显示的是如何做到这一点的样本的链接:

Here's a link showing a sample for how to do this:

http://msdn.microsoft.com/en-us/library/ aa984408%28VS.71%29.aspx

请注意,我不认为它需要为这一个参考工作。

Note, I don't think it needs to a reference for this to work.

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

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