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

◆ this[TKey key]

TValue System.Collections.Generic.SortedDictionary< TKey, TValue >.this[TKey key]
getset

Implements System.Collections.Generic.IDictionary< TKey, TValue >.

Definition at line 477 of file SortedDictionary.cs.

478 {
479 get
480 {
481 if (key == null)
482 {
483 throw new ArgumentNullException("key");
484 }
485 SortedSet<KeyValuePair<TKey, TValue>>.Node node = _set.FindNode(new KeyValuePair<TKey, TValue>(key, default(TValue)));
486 if (node == null)
487 {
488 throw new KeyNotFoundException(System.SR.Format(System.SR.Arg_KeyNotFoundWithKey, key.ToString()));
489 }
490 return node.Item.Value;
491 }
492 set
493 {
494 if (key == null)
495 {
496 throw new ArgumentNullException("key");
497 }
498 SortedSet<KeyValuePair<TKey, TValue>>.Node node = _set.FindNode(new KeyValuePair<TKey, TValue>(key, default(TValue)));
499 if (node == null)
500 {
501 _set.Add(new KeyValuePair<TKey, TValue>(key, value));
502 return;
503 }
504 node.Item = new KeyValuePair<TKey, TValue>(node.Item.Key, value);
505 _set.UpdateVersion();
506 }
507 }
void Add(TKey key, TValue value)
readonly TreeSet< KeyValuePair< TKey, TValue > > _set
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Arg_KeyNotFoundWithKey
Definition SR.cs:94
Definition SR.cs:7