using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace Core.LgMes.Client.LgJobMgt { public class Hashlist : IDictionary, IEnumerable, IDisposable { #region 成员变量 protected ArrayList m_oKeys;// = new ArrayList(); /// /// 数据存放Hash列表,主要是为了加快数据存放速度 /// protected Hashtable m_oValues;// = new Hashtable(); #endregion public Hashlist() { m_oKeys = new ArrayList(); m_oValues = new Hashtable(); } #region ICollection 接口派生函数 /// /// 数据节点个数 /// public int Count { get { return m_oValues.Count; } } /// /// /// public bool IsSynchronized { get { return m_oValues.IsSynchronized; } } /// /// /// public object SyncRoot { get { return m_oValues.SyncRoot; } } /// /// /// /// /// public void CopyTo(System.Array oArray, int iArrayIndex) { m_oValues.CopyTo(oArray, iArrayIndex); } #endregion #region IDictionary 接口函数 /// /// /// /// /// public void Add(object oKey, object oValue) { m_oKeys.Add(oKey); m_oValues.Add(oKey, oValue); } /// /// /// public bool IsFixedSize { get { return m_oKeys.IsFixedSize; } } /// /// /// public bool IsReadOnly { get { return m_oKeys.IsReadOnly; } } /// /// /// public ICollection Keys { get { return m_oValues.Keys; } } /// /// /// public void Clear() { m_oValues.Clear(); m_oKeys.Clear(); } /// /// /// /// /// public bool Contains(object oKey) { return m_oValues.Contains(oKey); } /// /// /// /// /// public bool ContainsKey(object oKey) { return m_oValues.ContainsKey(oKey); } /// /// /// /// public IDictionaryEnumerator GetEnumerator() { return m_oValues.GetEnumerator(); } /// /// /// /// public void Remove(object oKey) { m_oValues.Remove(oKey); m_oKeys.Remove(oKey); } /// /// /// public object this[object oKey] { get { return m_oValues[oKey]; } set { m_oValues[oKey] = value; } } /// /// /// public ICollection Values { get { return m_oValues.Values; } } #endregion #region IEnumerable 接口 IEnumerator IEnumerable.GetEnumerator() { return m_oValues.GetEnumerator(); } #endregion #region Hashlist 实现的查询对象 /// /// /// public object this[string Key] { get { return m_oValues[Key]; } } /// /// /// public object this[int Index] { get { return m_oValues[m_oKeys[Index]]; } } #endregion #region IDisposable 数据销毁接口 public void Dispose() { m_oKeys.Clear(); } #endregion } }