ResourceManager trying to load .resources not .resx file

前端 未结 5 1653
陌清茗
陌清茗 2021-01-11 12:21

I am trying to load a resx file in my .net website using:

ResourceManager rm = new ResourceManager( \"Project.Resource\", Assembly.GetExecutingAssembly() );
         


        
5条回答
  •  心在旅途
    2021-01-11 13:08

    To load .resx into ResourceManager you need specify namespace

    var rm = new ResourceManager("Namespace.ResxName", Assembly.GetAssembly());
    

    or you can get ResourceManager for free if set Access Modifier inside Managed Resource Editor to Internal or Public, after that VS will generate ResxName.Designer.cs

    var rm = ResxName.ResourceManager;
    

提交回复
热议问题