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

◆ GetSetMemberValueDelegateWithType< TObj, TParam >()

static SetMemberValueDelegate System.Xml.Serialization.ReflectionXmlSerializationReaderHelper.GetSetMemberValueDelegateWithType< TObj, TParam > ( MemberInfo memberInfo)
inlinestatic

Definition at line 10 of file ReflectionXmlSerializationReaderHelper.cs.

11 {
12 if (typeof(TObj).IsValueType)
13 {
15 if ((object)propInfo2 != null)
16 {
17 return delegate(object o, object p)
18 {
20 };
21 }
23 if ((object)fieldInfo != null)
24 {
25 return delegate(object o, object p)
26 {
28 };
29 }
31 }
32 Action<TObj, TParam> setTypedDelegate = null;
34 if ((object)propInfo != null)
35 {
37 if (setMethod == null)
38 {
39 return delegate(object o, object p)
40 {
41 propInfo.SetValue(o, p);
42 };
43 }
44 setTypedDelegate = (Action<TObj, TParam>)setMethod.CreateDelegate(typeof(Action<TObj, TParam>));
45 }
47 {
52 setTypedDelegate = Expression.Lambda<Action<TObj, TParam>>(body, new ParameterExpression[2] { parameterExpression, parameterExpression2 }).Compile();
53 }
54 return delegate(object o, object p)
55 {
57 };
58 }
static LambdaExpression Lambda(Expression body, params ParameterExpression[]? parameters)
static BinaryExpression Assign(Expression left, Expression right)
static ParameterExpression Parameter(Type type)
static MemberExpression Field(Expression? expression, FieldInfo field)
void SetValue(object? obj, object? value)
Definition FieldInfo.cs:108
virtual Delegate CreateDelegate(Type delegateType)
Definition MethodInfo.cs:48
void SetValue(object? obj, object? value)
static string XmlInternalError
Definition SR.cs:1812
Definition SR.cs:7

References System.Linq.Expressions.Expression< TDelegate >.Assign(), System.Reflection.MethodInfo.CreateDelegate(), System.Xml.Dictionary, System.Linq.Expressions.Expression< TDelegate >.Field(), System.Linq.Expressions.Expression< TDelegate >.Lambda(), System.Linq.Expressions.Expression< TDelegate >.Parameter(), System.Reflection.FieldInfo.SetValue(), System.Reflection.PropertyInfo.SetValue(), and System.SR.XmlInternalError.