1 首先在WPF应用程序创建App.config配置文件
刚创建好的配置文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>
2 为配置文件添加节点
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="xmlPath" value="\My.xml"/>
</appSettings>
</configuration>
3读取配置文件
//string CurrentDirectory = Environment.CurrentDirectory;获取当前debug路劲
string xmlPath = ConfigurationManager.AppSettings["xmlPath"];