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

C# .Net Core读取AppSettings

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

 C# .Net Core读取AppSettings

 3. 在App.config添加 appSettings节点

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

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

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

C# .Net Core读取AppSettings

 

相关文章:

  • 2021-12-09
  • 2022-12-23
  • 2021-09-30
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2022-02-17
  • 2022-12-23
相关资源
相似解决方案