private RoPropertyIndexParameter[] ComputeIndexParameters() { bool useGetter = CanRead; RoMethod accessor = (useGetter ? GetRoGetMethod() : GetRoSetMethod()); if (accessor == null) { throw new BadImageFormatException(); // Property has neither a getter or setter. } RoParameter[] methodParameters = accessor.GetParametersNoCopy(); int count = methodParameters.Length; if (!useGetter) { count--; // If we're taking the parameters off the setter, subtract one for the "value" parameter. } if (count == 0) { return(Array.Empty <RoPropertyIndexParameter>()); } RoPropertyIndexParameter[] indexParameters = new RoPropertyIndexParameter[count]; for (int i = 0; i < count; i++) { indexParameters[i] = new RoPropertyIndexParameter(this, methodParameters[i]); } return(indexParameters); }
public static RoMethod?FilterInheritedAccessor(this RoMethod accessor) { if (accessor.ReflectedType == accessor.DeclaringType) { return(accessor); } if (accessor.IsPrivate) { return(null); } // If the accessor is virtual, .NET Framework tries to look for a overriding member starting from ReflectedType - a situation // which probably isn't expressible in any known language. Detecting overrides veers into vtable-building business which // is something this library tries to avoid. If anyone ever cares about this, welcome to fix. return(accessor); }