<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="ConsoleApplication2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<ConsoleApplication2.Properties.Settings>
<setting name="ConsoleApplication2_localhost_Service1" serializeAs="String">
<value>http://localhost:4214/Service1.svc</value>
</setting>
</ConsoleApplication2.Properties.Settings>
</applicationSettings>
</configuration>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="ConsoleApplication2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<ConsoleApplication2.Properties.Settings>
<setting name="ConsoleApplication2_localhost_Service1" serializeAs="String">
<value>http://localhost:4214/Service1.svc</value>
</setting>
</ConsoleApplication2.Properties.Settings>
</applicationSettings>
</configuration>
C#代码:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
object obj = ConfigurationManager.GetSection("ConsoleApplication2.Properties.Settings");
Configuration config = ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);
ConfigurationSectionGroupCollection group = config.SectionGroups;
ConfigurationSectionGroup sectionGroup = group.Get("applicationSettings");
ConfigurationSection section = sectionGroup.Sections[0];
string strXml = section.SectionInformation.GetRawXml();
}
}
using System.Collections.Generic;
using System.Configuration;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
object obj = ConfigurationManager.GetSection("ConsoleApplication2.Properties.Settings");
Configuration config = ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);
ConfigurationSectionGroupCollection group = config.SectionGroups;
ConfigurationSectionGroup sectionGroup = group.Get("applicationSettings");
ConfigurationSection section = sectionGroup.Sections[0];
string strXml = section.SectionInformation.GetRawXml();
}
}
}