Hash Set : Set « Collections Data Structure « C# / C Sharp






Hash Set

 
//http://www.bouncycastle.org/
//MIT X11 License

using System;
using System.Collections;

namespace Org.BouncyCastle.Utilities.Collections
{
    public class HashSet
    {
        private readonly Hashtable impl = new Hashtable();

        public HashSet()
        {
        }

 

        public void Add(object o)
        {
            impl[o] = null;
        }

        public bool Contains(object o)
        {
            return impl.ContainsKey(o);
        }

        public void CopyTo(Array array, int index)
        {
            impl.Keys.CopyTo(array, index);
        }

        public int Count
        {
            get { return impl.Count; }
        }

        public IEnumerator GetEnumerator()
        {
            return impl.Keys.GetEnumerator();
        }

        public bool IsSynchronized
        {
            get { return impl.IsSynchronized; }
        }

        public void Remove(object o)
        {
            impl.Remove(o);
        }

        public object SyncRoot
        {
            get { return impl.SyncRoot; }
        }
    }
}

   
  








Related examples in the same category

1.Put the Set class into its own namespacePut the Set class into its own namespace
2.Generic Set
3.Hash Set 2