1
<?xml version="1.0" encoding="utf-8" ?>
2
<configuration>
3
<configSections>
4
<section name="TestSection" type="Test.TestSection,TestService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
5
</configSections>
6
<TestSection name="test" password="******">
7
<channels>
8
<add id="one" name="channel_1" />
9
<add id="two" name="channel_2" />
10
<add id="three" name="channel_3" />
11
</channels>
12
</TestSection>
13
</configuration>
2
3
4
5
6
7
8
9
10
11
12
13
1、元素要继承ConfigurationElement
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
using System.Configuration;
5
using System.Xml;
6
namespace Test
7
2、集合要继承ConfigurationElementCollection2
3
4
5
6
7
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
using System.Configuration;
5
namespace Test
6
}
3、节点要继承ConfigurationSection2
3
4
5
6
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
using System.Configuration;
5
using System.Xml;
6
7
namespace Test
8
4、Demo2
3
4
5
6
7
8
1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Text;
7
using System.Windows.Forms;
8
using System.Configuration;
9
10
namespace Test
11
}
2
3
4
5
6
7
8
9
10
11