从另一个程序集中检索字符串表

发布于 2024-12-23 17:00:53 字数 462 浏览 2 评论 0原文

我有一个程序集,我们称之为 A,其中包含一个字符串表,用于将字符串本地化为资源。我还有另一个程序集,称为 B,A 引用它,它必须使用程序集 A 中包含的那些字符串表。

代码现在在程序集 A 中引用该字符串表的方式是这样的:

localResourceManager = new ResourceManager("languageControl", typeof(frm_SomeForm).Assembly);
string someString = localResourceManager.GetString("SomeStringTxt");

形式 frm_SomeForm 是程序集 A 的一部分。

如何在程序集 B 中使用相同的 ResourceManager 而不必将这些相同的字符串表作为程序集 B 中的资源包含在内?

谢谢!

I have an assembly, let's call it A, which contains a string table for localizing strings as a resource. I also have another assembly, called B, which A references to, that has to use those string tables that are contained in assembly A.

The way the code is referencing that string table now in assembly A is this:

localResourceManager = new ResourceManager("languageControl", typeof(frm_SomeForm).Assembly);
string someString = localResourceManager.GetString("SomeStringTxt");

The form frm_SomeForm is part of assembly A.

How can I use that same ResourceManager in assembly B without having to include those same string tables as resources in assembly B?

Thanks!

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

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

发布评论

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

评论(1

遥远的绿洲 2024-12-30 17:00:53

向程序集 A 添加一个返回其 ResourceManager 的函数。

Add a function to assembly A that returns its ResourceManager.

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