Welcome to mirror list, hosted at ThFree Co, Russian Federation.

HashSet.cs « Internal « Reactive « System.Reactive.Linq « Rx.NET - github.com/mono/rx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f2a7d79efebbf6d1a660a9d061689869582d2ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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