예제 #1
0
 public void Remove(object key)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
     }
     this.version = this.version + 1;
     ListDictionaryInternal.DictionaryNode dictionaryNode1 = (ListDictionaryInternal.DictionaryNode)null;
     ListDictionaryInternal.DictionaryNode dictionaryNode2;
     for (dictionaryNode2 = this.head; dictionaryNode2 != null && !dictionaryNode2.key.Equals(key); dictionaryNode2 = dictionaryNode2.next)
     {
         dictionaryNode1 = dictionaryNode2;
     }
     if (dictionaryNode2 == null)
     {
         return;
     }
     if (dictionaryNode2 == this.head)
     {
         this.head = dictionaryNode2.next;
     }
     else
     {
         dictionaryNode1.next = dictionaryNode2.next;
     }
     this.count = this.count - 1;
 }
예제 #2
0
 public NodeEnumerator(ListDictionaryInternal list)
 {
     this.list    = list;
     this.version = list.version;
     this.start   = true;
     this.current = (ListDictionaryInternal.DictionaryNode)null;
 }
 // Token: 0x0600372E RID: 14126 RVA: 0x000D37C8 File Offset: 0x000D19C8
 public void Remove(object key)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
     }
     this.version++;
     ListDictionaryInternal.DictionaryNode dictionaryNode = null;
     ListDictionaryInternal.DictionaryNode next           = this.head;
     while (next != null && !next.key.Equals(key))
     {
         dictionaryNode = next;
         next           = next.next;
     }
     if (next == null)
     {
         return;
     }
     if (next == this.head)
     {
         this.head = next.next;
     }
     else
     {
         dictionaryNode.next = next.next;
     }
     this.count--;
 }
예제 #4
0
 public object this[object key]
 {
     get
     {
         if (key == null)
         {
             throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
         }
         for (ListDictionaryInternal.DictionaryNode dictionaryNode = this.head; dictionaryNode != null; dictionaryNode = dictionaryNode.next)
         {
             if (dictionaryNode.key.Equals(key))
             {
                 return(dictionaryNode.value);
             }
         }
         return((object)null);
     }
     set
     {
         if (key == null)
         {
             throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
         }
         if (!key.GetType().IsSerializable)
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), "key");
         }
         if (value != null && !value.GetType().IsSerializable)
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), "value");
         }
         this.version = this.version + 1;
         ListDictionaryInternal.DictionaryNode dictionaryNode1 = (ListDictionaryInternal.DictionaryNode)null;
         ListDictionaryInternal.DictionaryNode dictionaryNode2;
         for (dictionaryNode2 = this.head; dictionaryNode2 != null && !dictionaryNode2.key.Equals(key); dictionaryNode2 = dictionaryNode2.next)
         {
             dictionaryNode1 = dictionaryNode2;
         }
         if (dictionaryNode2 != null)
         {
             dictionaryNode2.value = value;
         }
         else
         {
             ListDictionaryInternal.DictionaryNode dictionaryNode3 = new ListDictionaryInternal.DictionaryNode();
             dictionaryNode3.key   = key;
             dictionaryNode3.value = value;
             if (dictionaryNode1 != null)
             {
                 dictionaryNode1.next = dictionaryNode3;
             }
             else
             {
                 this.head = dictionaryNode3;
             }
             this.count = this.count + 1;
         }
     }
 }
예제 #5
0
 public NodeKeyValueEnumerator(ListDictionaryInternal list, bool isKeys)
 {
     this.list    = list;
     this.isKeys  = isKeys;
     this.version = list.version;
     this.start   = true;
     this.current = (ListDictionaryInternal.DictionaryNode)null;
 }
 // Token: 0x17000838 RID: 2104
 public object this[object key]
 {
     get
     {
         if (key == null)
         {
             throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
         }
         for (ListDictionaryInternal.DictionaryNode next = this.head; next != null; next = next.next)
         {
             if (next.key.Equals(key))
             {
                 return(next.value);
             }
         }
         return(null);
     }
     set
     {
         if (key == null)
         {
             throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
         }
         if (!key.GetType().IsSerializable)
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), "key");
         }
         if (value != null && !value.GetType().IsSerializable)
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), "value");
         }
         this.version++;
         ListDictionaryInternal.DictionaryNode dictionaryNode = null;
         ListDictionaryInternal.DictionaryNode next           = this.head;
         while (next != null && !next.key.Equals(key))
         {
             dictionaryNode = next;
             next           = next.next;
         }
         if (next != null)
         {
             next.value = value;
             return;
         }
         ListDictionaryInternal.DictionaryNode dictionaryNode2 = new ListDictionaryInternal.DictionaryNode();
         dictionaryNode2.key   = key;
         dictionaryNode2.value = value;
         if (dictionaryNode != null)
         {
             dictionaryNode.next = dictionaryNode2;
         }
         else
         {
             this.head = dictionaryNode2;
         }
         this.count++;
     }
 }
예제 #7
0
 public void Reset()
 {
     if (this.version != this.list.version)
     {
         throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumFailedVersion"));
     }
     this.start   = true;
     this.current = (ListDictionaryInternal.DictionaryNode)null;
 }
예제 #8
0
 public bool Contains(object key)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
     }
     for (ListDictionaryInternal.DictionaryNode dictionaryNode = this.head; dictionaryNode != null; dictionaryNode = dictionaryNode.next)
     {
         if (dictionaryNode.key.Equals(key))
         {
             return(true);
         }
     }
     return(false);
 }
 // Token: 0x06003728 RID: 14120 RVA: 0x000D35A4 File Offset: 0x000D17A4
 public void Add(object key, object value)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
     }
     if (!key.GetType().IsSerializable)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), "key");
     }
     if (value != null && !value.GetType().IsSerializable)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), "value");
     }
     this.version++;
     ListDictionaryInternal.DictionaryNode dictionaryNode = null;
     ListDictionaryInternal.DictionaryNode next;
     for (next = this.head; next != null; next = next.next)
     {
         if (next.key.Equals(key))
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_AddingDuplicate__", new object[]
             {
                 next.key,
                 key
             }));
         }
         dictionaryNode = next;
     }
     if (next != null)
     {
         next.value = value;
         return;
     }
     ListDictionaryInternal.DictionaryNode dictionaryNode2 = new ListDictionaryInternal.DictionaryNode();
     dictionaryNode2.key   = key;
     dictionaryNode2.value = value;
     if (dictionaryNode != null)
     {
         dictionaryNode.next = dictionaryNode2;
     }
     else
     {
         this.head = dictionaryNode2;
     }
     this.count++;
 }
예제 #10
0
 public bool MoveNext()
 {
     if (this.version != this.list.version)
     {
         throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumFailedVersion"));
     }
     if (this.start)
     {
         this.current = this.list.head;
         this.start   = false;
     }
     else if (this.current != null)
     {
         this.current = this.current.next;
     }
     return(this.current != null);
 }
예제 #11
0
 public void Add(object key, object value)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
     }
     if (!key.GetType().IsSerializable)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), "key");
     }
     if (value != null && !value.GetType().IsSerializable)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), "value");
     }
     this.version = this.version + 1;
     ListDictionaryInternal.DictionaryNode dictionaryNode1 = (ListDictionaryInternal.DictionaryNode)null;
     ListDictionaryInternal.DictionaryNode dictionaryNode2;
     for (dictionaryNode2 = this.head; dictionaryNode2 != null; dictionaryNode2 = dictionaryNode2.next)
     {
         if (dictionaryNode2.key.Equals(key))
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_AddingDuplicate__", dictionaryNode2.key, key));
         }
         dictionaryNode1 = dictionaryNode2;
     }
     if (dictionaryNode2 != null)
     {
         dictionaryNode2.value = value;
     }
     else
     {
         ListDictionaryInternal.DictionaryNode dictionaryNode3 = new ListDictionaryInternal.DictionaryNode();
         dictionaryNode3.key   = key;
         dictionaryNode3.value = value;
         if (dictionaryNode1 != null)
         {
             dictionaryNode1.next = dictionaryNode3;
         }
         else
         {
             this.head = dictionaryNode3;
         }
         this.count = this.count + 1;
     }
 }
 // Token: 0x0600372B RID: 14123 RVA: 0x000D3710 File Offset: 0x000D1910
 public void CopyTo(Array array, int index)
 {
     if (array == null)
     {
         throw new ArgumentNullException("array");
     }
     if (array.Rank != 1)
     {
         throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
     }
     if (index < 0)
     {
         throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
     }
     if (array.Length - index < this.Count)
     {
         throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_Index"), "index");
     }
     for (ListDictionaryInternal.DictionaryNode next = this.head; next != null; next = next.next)
     {
         array.SetValue(new DictionaryEntry(next.key, next.value), index);
         index++;
     }
 }
예제 #13
0
 void ICollection.CopyTo(Array array, int index)
 {
     if (array == null)
     {
         throw new ArgumentNullException("array");
     }
     if (array.Rank != 1)
     {
         throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
     }
     if (index < 0)
     {
         throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
     }
     if (array.Length - index < this.list.Count)
     {
         throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_Index"), "index");
     }
     for (ListDictionaryInternal.DictionaryNode dictionaryNode = this.list.head; dictionaryNode != null; dictionaryNode = dictionaryNode.next)
     {
         array.SetValue(this.isKeys ? dictionaryNode.key : dictionaryNode.value, index);
         ++index;
     }
 }
예제 #14
0
 public void Clear()
 {
     this.count   = 0;
     this.head    = (ListDictionaryInternal.DictionaryNode)null;
     this.version = this.version + 1;
 }
예제 #15
0
 public NodeEnumerator(ListDictionaryInternal list)
 {
     this.list = list;
     this.version = list.version;
     this.start = true;
     this.current = null;
 }
예제 #16
0
 public NodeKeyValueEnumerator(ListDictionaryInternal list, bool isKeys)
 {
     this.list = list;
     this.isKeys = isKeys;
     this.version = list.version;
     this.start = true;
     this.current = null;
 }
예제 #17
0
 public bool MoveNext()
 {
     if (this.version != this.list.version)
     {
         throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumFailedVersion"));
     }
     if (this.start)
     {
         this.current = this.list.head;
         this.start = false;
     }
     else if (this.current != null)
     {
         this.current = this.current.next;
     }
     return (this.current != null);
 }
예제 #18
0
 public void Reset()
 {
     if (this.version != this.list.version)
     {
         throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumFailedVersion"));
     }
     this.start = true;
     this.current = null;
 }