diff options
Diffstat (limited to 'Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs')
-rw-r--r-- | Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs new file mode 100644 index 0000000..f2a7d79 --- /dev/null +++ b/Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#if NO_HASHSET +using System; +using System.Collections.Generic; + +namespace System.Reactive +{ + class HashSet<T> + { + private Dictionary<T, object> _set; + + public HashSet(IEqualityComparer<T> comparer) + { + _set = new Dictionary<T, object>(comparer); + } + + public bool Add(T value) + { + if (_set.ContainsKey(value)) + return false; + + _set[value] = null; + return true; + } + } +} +#endif
\ No newline at end of file |