.net 在config中取值

在config中取AppSettings下的值

ConfigurationManager.AppSettings[“AppId”];

例在config中取client 属性的值:

//获取client属性下的值
ClientSection clientSettings = ConfigurationManager.GetSection("system.serviceModel/client") as ClientSection;
//取client下值
 var address = clientSettings.Endpoints[0].Address.ToString()

 

posted @ 2024-12-27 17:03  一招致命九虎山  阅读(9)  评论(0)    收藏  举报