static PropertyInfo GetBasePropertyDefinition (PropertyInfo property)
{
MethodInfo method = property.GetGetMethod (true);
if (method == null || !method.IsVirtual)
method = property.GetSetMethod (true);
if (method == null || !method.IsVirtual)
return null;
MethodInfo baseMethod = method.GetBaseMethod ();
if (baseMethod != null && baseMethod != method) {
ParameterInfo[] parameters = property.GetIndexParameters ();
if (parameters != null && parameters.Length > 0) {
Type[] paramTypes = new Type[parameters.Length];
for (int i=0; i < paramTypes.Length; i++)
paramTypes[i] = parameters[i].ParameterType;
return baseMethod.DeclaringType.GetProperty (property.Name, property.PropertyType,
paramTypes);
} else {
return baseMethod.DeclaringType.GetProperty (property.Name, property.PropertyType);
}
}
return null;
}