在config中取值
2021-05-14 本文已影响0人
秒怂的哈士奇爱吃西瓜
在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()