Ejemplo n.º 1
0
        // <summary>
        // Compare Properties for two nodes. If all the properties for these two
        // nodes have the same value, return true. Otherwise, return false.
        //
        // </summary>
        // <param name="firstNode">The first node</param>
        // <param name="secondNode">The second node</param>
        private static bool CompareObjectProperties(object firstNode, object secondNode)
        {
            //
            // Compare CLR properties.
            //
            Dictionary <string, PropertyDescriptor> clrProperties1 = TreeComparer.GetClrProperties(firstNode);
            Dictionary <string, PropertyDescriptor> clrProperties2 = TreeComparer.GetClrProperties(secondNode);

            if (!TreeComparer.CompareClrPropertyCollection(firstNode, clrProperties1, secondNode, clrProperties2))
            {
                TreeComparer.SendCompareMessage("The first node and the second node are different in one or more CLR properties.");
                TreeComparer.Break();
                return(false);
            }

            if (!TreeComparer.ComparePropertyAsIEnumerable(firstNode, secondNode))
            {
                TreeComparer.SendCompareMessage("The first node and the second node are different collections.");
                TreeComparer.Break();
                return(false);
            }

            return(true);
        }