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

◆ GetProperty()

static PropertyInfo System.Linq.Expressions.Expression< TDelegate >.GetProperty ( MethodInfo mi,
string paramName,
int index = -1 )
inlinestaticprivateinherited

Definition at line 3785 of file Expression.cs.

3786 {
3787 Type declaringType = mi.DeclaringType;
3788 if (declaringType != null)
3789 {
3790 BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic;
3791 bindingFlags |= (mi.IsStatic ? BindingFlags.Static : BindingFlags.Instance);
3792 PropertyInfo[] properties = declaringType.GetProperties(bindingFlags);
3793 PropertyInfo[] array = properties;
3794 foreach (PropertyInfo propertyInfo in array)
3795 {
3796 if (propertyInfo.CanRead && CheckMethod(mi, propertyInfo.GetGetMethod(nonPublic: true)))
3797 {
3798 return propertyInfo;
3799 }
3800 if (propertyInfo.CanWrite && CheckMethod(mi, propertyInfo.GetSetMethod(nonPublic: true)))
3801 {
3802 return propertyInfo;
3803 }
3804 }
3805 }
3806 throw Error.MethodNotPropertyAccessor(mi.DeclaringType, mi.Name, paramName, index);
3807 }
static bool CheckMethod(MethodInfo method, MethodInfo propertyMethod)

References System.array, System.Reflection.PropertyInfo.CanRead, System.Reflection.PropertyInfo.CanWrite, System.Linq.Expressions.Expression< TDelegate >.CheckMethod(), System.Reflection.PropertyInfo.GetGetMethod(), System.Reflection.PropertyInfo.GetSetMethod(), System.Linq.index, and System.Linq.Expressions.Error.MethodNotPropertyAccessor().