private static PropertyInfo GetPropertyHelper(Type type, string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers, bool throwAmbiguousMatchException) { try { bool flag = false; if ((s_cbmTdpBridge != null) && IsFrameworkType(type)) { Type typeToUseForCBMBridge = GetTypeToUseForCBMBridge(type); flag = s_cbmTdpBridge.HasProperty(typeToUseForCBMBridge, name, bindingAttr); } else { Type reflectionType = GetReflectionType(type); Type type4 = GetReflectionType(returnType); Type[] reflectionTypes = GetReflectionTypes(types); flag = reflectionType.GetProperty(name, bindingAttr, binder, type4, reflectionTypes, modifiers) != null; } if (flag) { return(type.GetProperty(name, bindingAttr, binder, returnType, types, modifiers)); } } catch (AmbiguousMatchException) { if (throwAmbiguousMatchException) { throw; } return(GetMostSpecificProperty(type, name, bindingAttr)); } return(null); }
private static PropertyInfo GetPropertyHelper(Type type, string name, BindingFlags bindingAttr, Type returnType, Type[] types, bool throwAmbiguousMatchException) { try { bool hasProperty = false; if (s_cbmTdpBridge != null && IsFrameworkType(type)) { Type typeToUse = GetTypeToUseForCBMBridge(type); hasProperty = s_cbmTdpBridge.HasProperty(typeToUse, name, bindingAttr, returnType, types); } else { Type reflectionType = GetReflectionType(type); Type reflectionReturnType = GetReflectionType(returnType); Type[] reflectionTypes = GetReflectionTypes(types); PropertyInfo propInfo = reflectionType.GetProperty(name, bindingAttr, null /* binder */, reflectionReturnType, reflectionTypes, null /* modifiers */); hasProperty = propInfo != null; } // Return the actual runtime PropertyInfo only if it was found in the target type. if (hasProperty) { return(type.GetProperty(name, bindingAttr, null /* binder */, returnType, types, null /* modifiers */)); } } catch (AmbiguousMatchException) { if (throwAmbiguousMatchException) { throw; } return(GetMostSpecificProperty(type, name, bindingAttr, returnType, types)); } return(null); }