Using ResourceManager

前端 未结 6 1221
走了就别回头了
走了就别回头了 2020-12-08 07:38

I\'m trying to use the ResourceManager in a C# class, but don\'t know what to substitute for the basename when creating a new instance of the ResourceManager class.

6条回答
  •  鱼传尺愫
    2020-12-08 08:01

    There's surprisingly simple way of reading resource by string:

    ResourceNamespace.ResxFileName.ResourceManager.GetString("ResourceKey")
    

    It's clean and elegant solution for reading resources by keys where "dot notation" cannot be used (for instance when resource key is persisted in the database).

提交回复
热议问题