Example #1
0
        WeakDictionary(SerializationInfo serializationInfo, StreamingContext streamingContext)
        {
            var comparer = (KeyComparer <TStrongKey>)serializationInfo.GetValue("Comparer", typeof(KeyComparer <TStrongKey>));
            var items    = (List <KeyValuePair <TStrongKey, TValue> >)serializationInfo.GetValue("Items", typeof(List <KeyValuePair <TStrongKey, TValue> >));

            _internalDictionary = new InternalWeakDictionary(comparer);
            _internalDictionary.InsertContents(items);
        }
Example #2
0
        public WeakDictionary(IEnumerable <KeyValuePair <TStrongKey, TValue> > collection, IEqualityComparer <TStrongKey> strongKeyComparer)
        {
            _internalDictionary =
                new InternalWeakDictionary(
                    new KeyComparer <TStrongKey>(strongKeyComparer)
                    )
            ;

            _internalDictionary.InsertContents(collection);
        }
Example #3
0
        public WeakKeyDictionary(IEnumerable <KeyValuePair <Tuple <TWeakKey1, TWeakKey2, TStrongKey>, TValue> > collection, IEqualityComparer <TWeakKey1> weakKey1Comparer, IEqualityComparer <TWeakKey2> weakKey2Comparer, IEqualityComparer <TStrongKey> strongKeyComparer)
        {
            _internalDictionary =
                new InternalWeakDictionary(
                    new KeyComparer <TWeakKey1, TWeakKey2, TStrongKey>(weakKey1Comparer, weakKey2Comparer, strongKeyComparer)
                    )
            ;

            _internalDictionary.InsertContents(collection);
        }
Example #4
0
        public WeakDictionary(int concurrencyLevel, IEnumerable <KeyValuePair <TStrongKey, TValue> > collection, IEqualityComparer <TStrongKey> strongKeyComparer)
        {
            var contentsList = collection.ToList();

            _internalDictionary =
                new InternalWeakDictionary(
                    concurrencyLevel,
                    contentsList.Count,
                    new KeyComparer <TStrongKey>(strongKeyComparer)
                    )
            ;
            _internalDictionary.InsertContents(contentsList);
        }
        public WeakDictionary(int concurrencyLevel, IEnumerable <KeyValuePair <Tuple <TWeakKey1, TWeakKey2, TWeakKey3, TWeakKey4, TStrongKey>, TValue> > collection, IEqualityComparer <TWeakKey1> weakKey1Comparer, IEqualityComparer <TWeakKey2> weakKey2Comparer, IEqualityComparer <TWeakKey3> weakKey3Comparer, IEqualityComparer <TWeakKey4> weakKey4Comparer, IEqualityComparer <TStrongKey> strongKeyComparer)
        {
            var contentsList = collection.ToList();

            _internalDictionary =
                new InternalWeakDictionary(
                    concurrencyLevel,
                    contentsList.Count,
                    new KeyComparer <TWeakKey1, TWeakKey2, TWeakKey3, TWeakKey4, TStrongKey>(weakKey1Comparer, weakKey2Comparer, weakKey3Comparer, weakKey4Comparer, strongKeyComparer)
                    )
            ;
            _internalDictionary.InsertContents(contentsList);
        }