public static MethodInfo ResolveGetter(this PropertyRef propertyRef) { if (propertyRef.GetMethodMetadataToken.HasValue) { #if RuntimeHandles if (TryUseFastReflection(propertyRef.DeclaringType, out Module manifest)) { return((MethodInfo)manifest.ResolveMethod(propertyRef.GetMethodMetadataToken.Value)); } else #endif { return(propertyRef.PropertyInfo.GetMethod); } } return(null); }
public static PropertyInfo Resolve(this PropertyRef propertyRef) { if (propertyRef == null) { return(null); } Type type = propertyRef.DeclaringType.ResolvedType; if (TryUseFastReflection(propertyRef.DeclaringType, out Module manifest)) { return(type.GetRuntimeProperties().First(p => p.MetadataToken == propertyRef.MetadataToken)); } else { return(type.GetProperty(propertyRef.Name, AllMembers)); } }
public static PropertyInfo Resolve(this PropertyRef propertyRef) { if (propertyRef.IsEmpty) { return(null); } Type type = propertyRef.DeclaringType.Resolve(); #if RuntimeHandles return(type.GetRuntimeProperties().First(p => p.MetadataToken == propertyRef.MetadataToken)); #else foreach (var property in type.GetProperties(AllInstanceMembers)) { if (property.Name == propertyRef.Name) { return(property); } } return(null); #endif }
public MemberRef(PropertyRef property) : this() { this.Property = property; }