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

◆ this[object key]

object? IDictionary. System.Collections.Generic.SortedDictionary< TKey, TValue >.this[object key]
getsetprivate

Definition at line 553 of file SortedDictionary.cs.

554 {
555 get
556 {
557 if (IsCompatibleKey(key) && TryGetValue((TKey)key, out var value))
558 {
559 return value;
560 }
561 return null;
562 }
563 set
564 {
565 if (key == null)
566 {
567 throw new ArgumentNullException("key");
568 }
569 if (value == null && default(TValue) != null)
570 {
571 throw new ArgumentNullException("value");
572 }
573 try
574 {
575 TKey key2 = (TKey)key;
576 try
577 {
578 this[key2] = (TValue)value;
579 }
580 catch (InvalidCastException)
581 {
582 throw new ArgumentException(System.SR.Format(System.SR.Arg_WrongType, value, typeof(TValue)), "value");
583 }
584 }
585 catch (InvalidCastException)
586 {
587 throw new ArgumentException(System.SR.Format(System.SR.Arg_WrongType, key, typeof(TKey)), "key");
588 }
589 }
590 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
static string Arg_WrongType
Definition SR.cs:16
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7