How to access another assembly's .resx?

前端 未结 2 357
有刺的猬
有刺的猬 2021-01-08 01:06

I have an assembly which contains, among other things, a Messages.resx which contains strings of GUI messages such as Yes, No, OK, Cancel, Open, etc. My project references t

相关标签:
2条回答
  • 2021-01-08 01:42

    In the resource editor just mark the resources as public. By default the access modifier is internal. Then you can use it normally.

    If making it public is not an option then use InternalsVisibleTo assembly level attribute.

    0 讨论(0)
  • 2021-01-08 02:04

    Use ResourceManager Class

      // Retrieve the resource.
      ResourceManager rm = new ResourceManager("Messages" ,Assembly.Load(assemblyPath));
      string greeting = rm.GetString("Greeting");
    

    Hope this helps

    0 讨论(0)
提交回复
热议问题