app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AppConfig.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="ServiceName" value="TradePuller"/>
<add key="BusNodeName" value="BusNode_01"/>
<add key="BusNodePushAddress" value="tcp://192.168.1.57:22231"/>
<add key="PullTopic" value="ExecutionReport"/>
</appSettings>
<applicationSettings>
<AppConfig.Properties.Settings>
<setting name="ServiceName" serializeAs="String">
<value>TradePuller</value>
</setting>
<setting name="BusNodeName" serializeAs="String">
<value>BusNode_01</value>
</setting>
<setting name="BusNodePushAddress" serializeAs="String">
<value>tcp://192.168.1.57:22231</value>
</setting>
<setting name="PullTopic" serializeAs="String">
<value>ExecutionReport</value>
</setting>
</AppConfig.Properties.Settings>
</applicationSettings>
</configuration>
Programm
using System.Configuration;
class Program
{
static void Main(string[] args)
{
var serviceName = Properties.Settings.Default.ServiceName;
var busnode = Properties.Settings.Default.BusNodeName;
var busnodepush = Properties.Settings.Default.BusNodePushAddress;
var pulltopic = Properties.Settings.Default.PullTopic;
Console.WriteLine("Service:{0}\r\nBusNode:{1}\r\nBusNodePush:{2}\r\nPullTopic:{3}",
serviceName,
busnode,
busnodepush,
pulltopic);
Console.ReadLine();
serviceName = ConfigurationManager.AppSettings["ServiceName"];
busnode = ConfigurationManager.AppSettings["BusNodeName"];
busnodepush = ConfigurationManager.AppSettings["BusNodePushAddress"];
pulltopic = ConfigurationManager.AppSettings["PullTopic"];
Console.WriteLine("Service:{0}\r\nBusNode:{1}\r\nBusNodePush:{2}\r\nPullTopic:{3}",
serviceName,
busnode,
busnodepush,
pulltopic);
Console.ReadLine();
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AppConfig.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="ServiceName" value="TradePuller"/>
<add key="BusNodeName" value="BusNode_01"/>
<add key="BusNodePushAddress" value="tcp://192.168.1.57:22231"/>
<add key="PullTopic" value="ExecutionReport"/>
</appSettings>
<applicationSettings>
<AppConfig.Properties.Settings>
<setting name="ServiceName" serializeAs="String">
<value>TradePuller</value>
</setting>
<setting name="BusNodeName" serializeAs="String">
<value>BusNode_01</value>
</setting>
<setting name="BusNodePushAddress" serializeAs="String">
<value>tcp://192.168.1.57:22231</value>
</setting>
<setting name="PullTopic" serializeAs="String">
<value>ExecutionReport</value>
</setting>
</AppConfig.Properties.Settings>
</applicationSettings>
</configuration>
Programm
using System.Configuration;
class Program
{
static void Main(string[] args)
{
var serviceName = Properties.Settings.Default.ServiceName;
var busnode = Properties.Settings.Default.BusNodeName;
var busnodepush = Properties.Settings.Default.BusNodePushAddress;
var pulltopic = Properties.Settings.Default.PullTopic;
Console.WriteLine("Service:{0}\r\nBusNode:{1}\r\nBusNodePush:{2}\r\nPullTopic:{3}",
serviceName,
busnode,
busnodepush,
pulltopic);
Console.ReadLine();
serviceName = ConfigurationManager.AppSettings["ServiceName"];
busnode = ConfigurationManager.AppSettings["BusNodeName"];
busnodepush = ConfigurationManager.AppSettings["BusNodePushAddress"];
pulltopic = ConfigurationManager.AppSettings["PullTopic"];
Console.WriteLine("Service:{0}\r\nBusNode:{1}\r\nBusNodePush:{2}\r\nPullTopic:{3}",
serviceName,
busnode,
busnodepush,
pulltopic);
Console.ReadLine();
}
}
Комментариев нет:
Отправить комментарий