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

◆ TrySetValue()

void System.Dynamic.ExpandoObject.TrySetValue ( object indexClass,
int index,
object value,
string name,
bool ignoreCase,
bool add )
inlinepackage

Definition at line 538 of file ExpandoObject.cs.

539 {
540 ExpandoData expandoData;
541 object obj;
543 {
545 if (expandoData.Class != indexClass || ignoreCase)
546 {
547 index = expandoData.Class.GetValueIndex(name, ignoreCase, this);
548 switch (index)
549 {
550 case -2:
552 case -1:
553 {
554 int num = (ignoreCase ? expandoData.Class.GetValueIndexCaseSensitive(name) : index);
555 if (num != -1)
556 {
557 index = num;
558 break;
559 }
560 ExpandoClass newClass = expandoData.Class.FindNewClass(name);
562 index = expandoData.Class.GetValueIndexCaseSensitive(name);
563 break;
564 }
565 }
566 }
568 if (obj == Uninitialized)
569 {
570 _count++;
571 }
572 else if (add)
573 {
574 throw Error.SameKeyExistsInExpando(name);
575 }
577 }
578 PropertyChangedEventHandler propertyChanged = _propertyChanged;
579 if (propertyChanged != null && value != obj)
580 {
582 }
583 }
ExpandoData PromoteClassCore(ExpandoClass oldClass, ExpandoClass newClass)
PropertyChangedEventHandler _propertyChanged
static readonly object Uninitialized
static Exception AmbiguousMatchInExpandoObject(object p0)
Definition Error.cs:23
static Exception SameKeyExistsInExpando(object key)
Definition Error.cs:28

References System.Dynamic.ExpandoObject._count, System.Dynamic.ExpandoObject._data, System.Dynamic.ExpandoObject._propertyChanged, System.Linq.Expressions.Error.AmbiguousMatchInExpandoObject(), System.index, System.Collections.Generic.Dictionary< TKey, TValue >.Keys, System.Dynamic.ExpandoObject.LockObject, System.obj, System.Dynamic.ExpandoObject.PromoteClassCore(), System.Linq.Expressions.Error.SameKeyExistsInExpando(), System.Dynamic.ExpandoObject.Uninitialized, and System.value.

Referenced by System.Dynamic.ExpandoObject.TryAddMember().