1. 设置配置文件
App.config 中添加 appSettings 节点内容
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<appSettings>
<add key="ServiceURL_1" value="name=service1; url=http://localhost:64049/"/>
<add key="ServiceURL_2" value="name=service2; url=http://localhost:64050/"/>
</appSettings>
</configuration>
2. EnvItem类创建
class EnvItem
{
public string Index {
get; set; }
public string Key {
get; set; }
public string Value {
get; set; }
public EnvItem(string index