Set
1using System; 2using System.Collections; 3namespace Utilities 4{ 5 /**//// <summary> 6 /// Provide a collection that contains a group of unique 7 /// objects. 8 /// </summary> 9 public class Set10 {11 private Hashtable h = new Hashtable();12 /**//// <summary>13 /// Return an enumerator for this set.14 /// </summary>15 /// <returns>An enumerator for this set</returns>16 public IEnumerator GetEnumerator()17 {18 return h.Keys.GetEnumerator();19 }20 /**//// <summary>21 /// Add the provided object to this set.22 /// </summary>23 /// <param name="o">the object to add</param>24 public void Add(Object o)25 {26 h[o] = null;27 }28 /**//// <summary>29 /// Return true if the set contains the presented object.30 /// </summary>31 /// <param name="o">the object of curiosity</param>32 /// <returns>true, if the set contains the presented object</returns>33 public bool Contains(Object o)34 {35 return h.Contains(o);36 }37 }38}
转载于:https://www.cnblogs.com/nanshouyong326/archive/2007/05/09/740016.html
相关资源:数据结构—成绩单生成器
转载请注明原文地址: https://win8.8miu.com/read-1483517.html