如何从外部程序集访问资源

发布于 2024-08-28 23:58:39 字数 77 浏览 3 评论 0原文

我想创建一个 vb.net 项目,仅用于保存多个项目中需要的图像和字符串资源。

我不知道如何使用其他项目的代码访问这些资源。

I want to create a vb.net project that I will use to only hold image and string resources that I will need in multiple projects.

What I can't figure out is how do I access these resources using code from other projects.

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

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

发布评论

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

评论(1

此岸叶落 2024-09-04 23:58:39

您需要通过在项目中引用程序集或调用 Assembly.Load 来加载程序集来加载实际的 DLL 文件并创建一个名为 ResourceManager 的新对象,并传递您加载的程序集或程序集的类型(如果您引用了它)在你的项目中)。

然后从资源管理器(GetString、GetInt、GetImage 等)调用附属程序集所保存的不同内容。

You'll need to load the assembly by either referencing it in your projects or calling Assembly.Load to load the actual DLL files and create a new object called ResourceManager passing along the assembly you loaded or the type of the assembly (if you referenced it in your project).

Then make calls from the Resource manager (GetString, GetInt, GetImage, etc) for the different things the satellite assembly holds.

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