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

◆ CreateGetter()

static Getter System.Runtime.Serialization.FastInvokerBuilder.CreateGetter ( MemberInfo memberInfo)
inlinestatic

Definition at line 29 of file FastInvokerBuilder.cs.

30 {
31 if (memberInfo is PropertyInfo propertyInfo)
32 {
33 Func<PropertyInfo, Getter> func = s_createGetterInternal.MakeGenericMethod(propertyInfo.DeclaringType, propertyInfo.PropertyType).CreateDelegate<Func<PropertyInfo, Getter>>();
34 return func(propertyInfo);
35 }
37 if ((object)fieldInfo != null)
38 {
39 return (object obj) => fieldInfo.GetValue(obj);
40 }
41 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.SR.Format(System.SR.InvalidMember, DataContract.GetClrTypeFullName(memberInfo.DeclaringType), memberInfo.Name)));
42 }
object? GetValue(object? obj)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string InvalidMember
Definition SR.cs:154
Definition SR.cs:7

References System.Runtime.Serialization.Dictionary, System.SR.Format(), System.Runtime.Serialization.DataContract.GetClrTypeFullName(), System.Reflection.FieldInfo.GetValue(), System.SR.InvalidMember, System.obj, System.Runtime.Serialization.FastInvokerBuilder.s_createGetterInternal, and System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError().