Read Value from Resource file using String

前端 未结 2 1132
长发绾君心
长发绾君心 2021-01-12 20:05

I have an enum with some data on it, also I have a resource file with the same data of the enum but using different translation

Ex.

         


        
相关标签:
2条回答
  • 2021-01-12 20:24

    If you are using a local resource and the name of the resource item is Sun, u can write the following

    GetLocalResourceObject("Sun").ToString();
    

    Edited: don't forget to name the resource file as ur webpage file name and use a App_LocalResources: EX: webpage is Test.aspx , then your resource file is Test.aspx.resx

    0 讨论(0)
  • 2021-01-12 20:46

    The resource is probably be a part of your assembly. Why don't you use the following? Resources.ResourceManager.GetString(test.Sun.ToString())

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