C#读配置文件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_38208401/article/details/80662925

1、C#读配置文件

1)在项目工程的App.config中添加

<appSettings>
    <add key="PathKey" value="C:\Users\yaowanjun\Downloads\配置.csv" />
  </appSettings>

2)引用需要添加程序集System.Configuration
这里写图片描述

3)读取配置文件

string str = ConfigurationManager.AppSettings["PathKey"];

猜你喜欢

转载自blog.csdn.net/weixin_38208401/article/details/80662925