schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Configuration;
 
namespace Sodao.FastSocket.Server.Config
{
    /// <summary>
    /// 服务器集合。
    /// </summary>
    [ConfigurationCollection(typeof(Server), AddItemName = "server")]
    public class ServerCollection : ConfigurationElementCollection
    {
        /// <summary>
        /// 创建新元素。
        /// </summary>
        /// <returns></returns>
        protected override ConfigurationElement CreateNewElement()
        {
            return new Server();
        }
        /// <summary>
        /// 获取指定元素的Key。
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        protected override object GetElementKey(ConfigurationElement element)
        {
            var server = element as Server;
            return server.Name;
        }
        /// <summary>
        /// 获取指定位置的对象。
        /// </summary>
        /// <param name="i"></param>
        /// <returns></returns>
        public Server this[int i]
        {
            get { return BaseGet(i) as Server; }
        }
    }
}