using System;
using System.Collections;

namespace ZXDT.DBUtility
{
    /// <summary>
    /// 按什么顺序加进去就按什么顺序输出Hashtable
    /// </summary>
    public class NoSortHashtable : Hashtable
    {
        private ArrayList list = new ArrayList();

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="key">主键</param>
        /// <param name="value">值</param>
        public override void Add(object key, object value)
        {
            base.Add(key, value);
            list.Add(key);
        }

        /// <summary>
        /// 清空
        /// </summary>
        public override void Clear()
        {
            base.Clear();
            list.Clear();
        }

        /// <summary>
        /// 移除
        /// </summary>
        /// <param name="key">主键</param>
        public override void Remove(object key)
        {
            base.Remove(key);
            list.Remove(key);
        }

        /// <summary>
        /// 主键
        /// </summary>
        public override ICollection Keys
        {
            get
            {
                return list;
            }
        }
    }
}
