C#配置文件读取
1.Section节点内容
<configSections>
<section name="RabbitMQ" type="System.Configuration.NameValueSectionHandler" />
</configSections>
<RabbitMQ>
<add key="hostName" value="localhost"/>
</RabbitMQ>
2.读取配置信息
var section = (NameValueCollection)ConfigurationSettings.GetConfig(const_RabbitMQSection);
var hostname=section["hostName"];