コード例 #1
0
        public void OnDeserialization(object sender)
        {
            if (this.SInfo == null)
            {
                return;
            }

            KeyValuePair <TKey, TValue>[] serializedKey2Value = this.DeserializeElements();

            IComparer <TKey> serializedKey2ValueComparer;

            this.Key2Value = TryDeserializeValue(KeyComparerName, out serializedKey2ValueComparer, sender)
                ? new SortedDictionary <TKey, TValue>(serializedKey2ValueComparer)
                : new SortedDictionary <TKey, TValue>();

            IComparer <TValue> serializedValue2KeyComparer;

            this.Value2Key = TryDeserializeValue(ValueComparerName, out serializedValue2KeyComparer, sender)
                ? new SortedDictionary <TValue, TKey>(serializedValue2KeyComparer)
                : new SortedDictionary <TValue, TKey>();

            this.reversed = new SortedReversibleDictionary <TValue, TKey>(this.Value2Key, this.Key2Value, this);
            this.AddAll(serializedKey2Value);
            this.SInfo = null;
        }
コード例 #2
0
 private SortedReversibleDictionary(
     SortedDictionary <TKey, TValue> key2value,
     SortedDictionary <TValue, TKey> value2key,
     SortedReversibleDictionary <TValue, TKey> reverse)
     : base(key2value, value2key)
 {
     this.reversed = reverse;
 }
コード例 #3
0
 public SortedReversibleDictionary(IComparer <TKey> keyComparer, IComparer <TValue> valueComparer)
 {
     this.Key2Value = new SortedDictionary <TKey, TValue>(keyComparer);
     this.Value2Key = new SortedDictionary <TValue, TKey>(valueComparer);
     this.reversed  = new SortedReversibleDictionary <TValue, TKey>(this.Value2Key, this.Key2Value, this);
 }