// <summary> // Compare a collection of clr properties. // </summary> // <returns> // true, if all properties are equivalent // false, otherwise // </returns> private static bool CompareClrPropertyCollection( Object firstNode, Dictionary <string, PropertyDescriptor> properties1, Object secondNode, Dictionary <string, PropertyDescriptor> properties2) { IEnumerator <string> ie1 = properties1.Keys.GetEnumerator(); while (ie1.MoveNext()) { string propertyName = ie1.Current; // Check that the second tree contains the property. if (!properties2.ContainsKey(propertyName)) { TreeComparer.SendCompareMessage("Property '" + propertyName + "' is not in second tree."); TreeComparer.Break(); return(false); } // If property was in skip collection, ignore it if (!TreeComparer.ShouldIgnoreProperty(propertyName, firstNode, IgnoreProperty.IgnoreValueOnly)) { // Compare properties if (!TreeComparer.CompareClrProperty( firstNode, properties1[propertyName], secondNode, properties2[propertyName])) { TreeComparer.SendCompareMessage("Value of property '" + propertyName + "' is different."); TreeComparer.Break(); return(false); } } properties2.Remove(propertyName); } // Check that the second tree doesn't have more properties than the first tree. if (properties2.Count > 0) { IEnumerator <string> ie2 = properties2.Keys.GetEnumerator(); ie2.MoveNext(); TreeComparer.SendCompareMessage("Property '" + properties2[ie2.Current].Name + "' is not in first tree."); TreeComparer.Break(); return(false); } return(true); }