ConfigurationManager.AppSettings use another config file

前端 未结 3 443
既然无缘
既然无缘 2020-12-16 20:22

I have about 10 methods in my class. In every method I use ConfigurationManager.AppSettings to get value form App.config file

like

 _a         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-16 20:55

    You could do something like this

    var fileConfig = ConfigurationManager.OpenExeConfiguration("");
    int port = int.Parse(fileConfig.AppSettings["PortNumber"].ToString());
    

提交回复
热议问题