Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Add()

void System.Collections.Specialized.ListDictionary.Add ( object key,
object? value )
inline

Implements System.Collections.IDictionary.

Definition at line 327 of file ListDictionary.cs.

328 {
329 if (key == null)
330 {
331 throw new ArgumentNullException("key");
332 }
333 version++;
334 DictionaryNode dictionaryNode = null;
335 for (DictionaryNode next = head; next != null; next = next.next)
336 {
337 object key2 = next.key;
338 if ((comparer == null) ? key2.Equals(key) : (comparer.Compare(key2, key) == 0))
339 {
341 }
342 dictionaryNode = next;
343 }
344 DictionaryNode dictionaryNode2 = new DictionaryNode();
345 dictionaryNode2.key = key;
346 dictionaryNode2.value = value;
347 if (dictionaryNode != null)
348 {
349 dictionaryNode.next = dictionaryNode2;
350 }
351 else
352 {
353 head = dictionaryNode2;
354 }
355 count++;
356 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Argument_AddingDuplicate
Definition SR.cs:14
Definition SR.cs:7

References System.SR.Argument_AddingDuplicate, System.Collections.IComparer.Compare(), System.Collections.Specialized.ListDictionary.comparer, System.Collections.Specialized.ListDictionary.count, System.SR.Format(), System.Collections.Specialized.ListDictionary.head, System.Collections.Specialized.ListDictionary.DictionaryNode.key, System.key, System.Collections.Specialized.ListDictionary.DictionaryNode.next, System.value, and System.Collections.Specialized.ListDictionary.version.

Referenced by System.Collections.Specialized.HybridDictionary.Add().