ConfigurationSettings.AppSettings is obsolete, warning

后端 未结 4 487
眼角桃花
眼角桃花 2021-01-03 00:51
var values = new NameValueCollection
{
    { \"key\", ConfigurationSettings.AppSettings[\"API-Key\"].ToString() },
    { \"image\", Convert.ToBase64String(File.ReadA         


        
4条回答
  •  独厮守ぢ
    2021-01-03 01:45

    Use the System.Configuration.ConfigurationManager class

    string ServerName = System.Configuration.ConfigurationManager.AppSettings["Servername"];
    

    Edit - added

    Note, you may have to add a reference to System.Configuration.dll. Even if you can import the namespace without the reference, you will not be able to access this class unless you have the reference.

提交回复
热议问题