C# .Net Core读取AppSettings

1.右击项目添加应用程序配置文件

 2.通过NuGet包管理器,添加System.Configuration.ConfigurationManager包

 

 3. 在App.config添加 appSettings节点

  <appSettings>
    <add key="YourKey" value="YourValue"/>
  </appSettings>

4. 在程序中读取配置文件

System.Configuration.ConfigurationManager.AppSettings["YourKey"]

 

posted @ 2020-11-30 16:56  NiKaFace  阅读(1824)  评论(0编辑  收藏  举报