Getting a string dynamically from strings resources

前端 未结 5 2166
鱼传尺愫
鱼传尺愫 2020-12-09 08:11

I am working on a localised C#.NET application and we are using a strings.resx file to translate hardcoded strings in the application. I use the following code

5条回答
  •  青春惊慌失措
    2020-12-09 08:25

    I had the same problem using ASP.NET Core MVC and managed to solve it using

    ResourceManager rm = new ResourceManager(typeof(YourResourceClass));
    string someString = rm.GetString("someString");
    

    Very similar to @Vlad's solution, but otherwise I had a MissingManifestResourceException

提交回复
热议问题