External/OxyPlot/OxyPlot.WindowsForms/HashSet.cs
author StephaneLenclud
Mon, 02 Feb 2015 20:58:28 +0100
branchMiniDisplay
changeset 448 10c04c79527e
permissions -rw-r--r--
Sync: Adding shamap and documentation to enable easier sync next time OHM is updated.
moel@392
     1

moel@392
     2
namespace OxyPlot.WindowsForms {
moel@392
     3
  using System;
moel@392
     4
  using System.Collections.Generic;
moel@392
     5
  using System.Text;
moel@392
     6
moel@392
     7
  public class HashSet<T> {
moel@392
     8
moel@392
     9
    private readonly Dictionary<T, object> set = new Dictionary<T, object>();
moel@392
    10
moel@392
    11
    public bool Add(T value) {
moel@392
    12
      if (set.ContainsKey(value))
moel@392
    13
        return true;
moel@392
    14
moel@392
    15
      set.Add(value, null);
moel@392
    16
      return false;
moel@392
    17
    }
moel@392
    18
moel@392
    19
    public bool Contains(T value) {
moel@392
    20
      return set.ContainsKey(value);
moel@392
    21
    }
moel@392
    22
moel@392
    23
    public void Clear() {
moel@392
    24
      set.Clear();
moel@392
    25
    }
moel@392
    26
  }
moel@392
    27
}