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

◆ CreateSetterInternal< DeclaringType, PropertyType >()

static Setter System.Runtime.Serialization.FastInvokerBuilder.CreateSetterInternal< DeclaringType, PropertyType > ( PropertyInfo propInfo)
inlinestaticprivate

Definition at line 97 of file FastInvokerBuilder.cs.

98 {
99 if (typeof(DeclaringType).IsGenericType && typeof(DeclaringType).GetGenericTypeDefinition() == typeof(KeyValue<, >))
100 {
101 if (propInfo.Name == "Key")
102 {
103 return delegate(ref object obj, object val)
104 {
105 ((IKeyValue)obj).Key = val;
106 };
107 }
108 return delegate(ref object obj, object val)
109 {
110 ((IKeyValue)obj).Value = val;
111 };
112 }
113 if (typeof(DeclaringType).IsValueType)
114 {
116 return delegate(ref object obj, object val)
117 {
118 DeclaringType obj2 = (DeclaringType)obj;
119 setMethod2(ref obj2, (PropertyType)val);
120 obj = obj2;
121 };
122 }
123 Action<DeclaringType, PropertyType> setMethod = propInfo.SetMethod.CreateDelegate<Action<DeclaringType, PropertyType>>();
124 return delegate(ref object obj, object val)
125 {
126 setMethod((DeclaringType)obj, (PropertyType)val);
127 };
128 }

References System.Runtime.Serialization.Dictionary, and System.obj.