.NET 实现Hashlist--可以排序的哈希表
来源:互联网 发布:java排序算法大到小 编辑:程序博客网 时间:2024/06/10 17:55
- /// <summary>
- ///
- /// </summary>
- public abstract class Hashlist : IDictionary, IEnumerable
- {
- //array list that contains all the keys
- //as they are inserted, the index is associated with
- //a key so when pulling out values by index
- //we can get the key for the index, pull from the
- //hashtable the proper value with the corresponding
- //key
- //This is basically the same as a sorted list but
- //does not sort the items, rather it leaves them in the
- //order they were inserted - like a list
- /// <summary>
- ///
- /// </summary>
- protected ArrayList m_oKeys = new ArrayList();
- /// <summary>
- ///
- /// </summary>
- protected Hashtable m_oValues = new Hashtable();
- #region ICollection implementation
- //ICollection implementation
- /// <summary>
- ///
- /// </summary>
- public int Count
- {
- get{return m_oValues.Count;}
- }
- /// <summary>
- ///
- /// </summary>
- public bool IsSynchronized
- {
- get{return m_oValues.IsSynchronized;}
- }
- /// <summary>
- ///
- /// </summary>
- public object SyncRoot
- {
- get{return m_oValues.SyncRoot;}
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="oArray"></param>
- /// <param name="iArrayIndex"></param>
- public void CopyTo(System.Array oArray, int iArrayIndex)
- {
- m_oValues.CopyTo(oArray, iArrayIndex);
- }
- #endregion
- #region IDictionary implementation
- //IDictionary implementation
- /// <summary>
- ///
- /// </summary>
- /// <param name="oKey"></param>
- /// <param name="oValue"></param>
- public void Add(object oKey, object oValue)
- {
- m_oKeys.Add(oKey);
- m_oValues.Add(oKey, oValue);
- }
- /// <summary>
- ///
- /// </summary>
- public bool IsFixedSize
- {
- get{return m_oKeys.IsFixedSize;}
- }
- /// <summary>
- ///
- /// </summary>
- public bool IsReadOnly
- {
- get{return m_oKeys.IsReadOnly;}
- }
- /// <summary>
- ///
- /// </summary>
- public ICollection Keys
- {
- get{return m_oValues.Keys;}
- }
- /// <summary>
- ///
- /// </summary>
- public void Clear()
- {
- m_oValues.Clear();
- m_oKeys.Clear();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="oKey"></param>
- /// <returns></returns>
- public bool Contains(object oKey)
- {
- return m_oValues.Contains(oKey);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="oKey"></param>
- /// <returns></returns>
- public bool ContainsKey(object oKey)
- {
- return m_oValues.ContainsKey(oKey);
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public IDictionaryEnumerator GetEnumerator()
- {
- return m_oValues.GetEnumerator();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="oKey"></param>
- public void Remove(object oKey)
- {
- m_oValues.Remove(oKey);
- m_oKeys.Remove(oKey);
- }
- /// <summary>
- ///
- /// </summary>
- public object this[object oKey]
- {
- get{return m_oValues[oKey];}
- set{m_oValues[oKey] = value;}
- }
- /// <summary>
- ///
- /// </summary>
- public ICollection Values
- {
- get{return m_oValues.Values;}
- }
- #endregion
- #region IEnumerable implementation
- IEnumerator IEnumerable.GetEnumerator()
- {
- return m_oValues.GetEnumerator();
- }
- #endregion
- #region Hashlist specialized implementation
- //specialized indexer routines
- /// <summary>
- ///
- /// </summary>
- public object this[string Key]
- {
- get{return m_oValues[Key];}
- }
- /// <summary>
- ///
- /// </summary>
- public object this[int Index]
- {
- get{return m_oValues[m_oKeys[Index]];}
- }
- #endregion
- }
- .NET 实现Hashlist--可以排序的哈希表
- hashlist的遍历
- 按首字母分类并排序显示的列表(二)--给BaseExpandableListAdapter提供数据的HashList
- [VB.NET]如何在DataGridView中实现多列排序?大于2列的,可以有很多列的排序?(急)
- Java中可以对element实现排序的Vector
- 使用LinkedHashMap可以实现按照插入的顺序进行排序
- 点击弹出框,实现可以搜索的ListView排序数据
- .Net中实现常见的排序算法
- .NET源码的内部排序实现
- 模拟Asp.Net Forums实现可以换皮肤的控件
- 模拟Asp.Net Forums实现可以换皮肤的控件
- 邮件发送.net 的实现 vs2008 可以加附件
- System.Net.Mail 可以轻松的实现邮件收发
- 使用回调函数实现一个通用的冒泡排序,可以排序不同的数据类型。
- 可以排序的ListView (备份一下,找这个排序实现不容易啊)
- 自己实现一个bubble_sort(冒泡排序),可以完成不同类型数据的排序
- XSL/XSLT也可以实现随机排序
- 可以进行原地排序的计数排序
- Love is Special
- SuperMap Object 读取SQL数据库中的地图
- c#常用的技巧
- 如何评估工作offer
- DWR2.0 util.js方法说明
- .NET 实现Hashlist--可以排序的哈希表
- bboss persistent连接池启动过程中报jndi 查找异常处理
- NET Managed Provider for Oracle 在 US7ASCII 中文乱码
- 在Redhat Linux上安装Oracle XE
- SuperMap Object 基本编程
- ubuntu8.10 开源系统
- 【转帖】中小网站运营推广思路
- MyEclipse下配置heritrix 1.12.1步骤
- 如何清除服务端缓存?