Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ReflectionXmlSerializationReaderHelper.cs
Go to the documentation of this file.
3
5
7{
8 public delegate void SetMemberValueDelegate(object o, object val);
9
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 {
36 MethodInfo setMethod = propInfo.GetSetMethod(nonPublic: true);
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 }
59}
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
delegate void SetMemberValueDelegate(object o, object val)
static SetMemberValueDelegate GetSetMemberValueDelegateWithType< TObj, TParam >(MemberInfo memberInfo)