private static void AddProperty(PropertyTable propertyTable, ICollection <PropertyBinding> memberList, Type declaringType, PropertyBinding memberBinding, MemberInfo memberInfo) { // Check if we already have a member with the same name declared. PropertyTable.Entry exisitingMemberEntry = propertyTable[memberBinding.Name]; if (exisitingMemberEntry != null) { // Ok we have one. Check if the existing member is not more specific. if (ExistingMemberIsMoreSpecific(declaringType, exisitingMemberEntry.MemberInfo, memberInfo)) { // The existing member is more specific. So we don't add the new one. return; } else { // The new member is more specific. Remove the old one. propertyTable.Remove(exisitingMemberEntry); memberList.Remove(exisitingMemberEntry.PropertyBinding); } } // Either the new member is more specific or we don't had // a member with same name. propertyTable.Add(memberBinding, memberInfo); memberList.Add(memberBinding); }
private static void AddProperty(PropertyTable propertyTable, ICollection<PropertyBinding> memberList, Type declaringType, PropertyBinding memberBinding, MemberInfo memberInfo) { // Check if we already have a member with the same name declared. PropertyTable.Entry exisitingMemberEntry = propertyTable[memberBinding.Name]; if (exisitingMemberEntry != null) { // Ok we have one. Check if the existing member is not more specific. if (ExistingMemberIsMoreSpecific(declaringType, exisitingMemberEntry.MemberInfo, memberInfo)) { // The existing member is more specific. So we don't add the new one. return; } else { // The new member is more specific. Remove the old one. propertyTable.Remove(exisitingMemberEntry); memberList.Remove(exisitingMemberEntry.PropertyBinding); } } // Either the new member is more specific or we don't had // a member with same name. propertyTable.Add(memberBinding, memberInfo); memberList.Add(memberBinding); }