KellermanSoftware.Compare-NET-Objects-Portable Cache for properties, fields, and methods to speed up reflection Reflection Cache for property info Reflection Cache for field info Reflection Cache for methods Static constructor Clear the cache Get a list of the fields within a type Get the value of a property Get a list of the properties in a type Get a method by name Get the cached methods for a type Class that allows comparison of two objects of the same type to each other. Supports classes, lists, arrays, dictionaries, child comparison and more. CompareLogic compareLogic = new CompareLogic(); Person person1 = new Person(); person1.DateCreated = DateTime.Now; person1.Name = "Greg"; Person person2 = new Person(); person2.Name = "John"; person2.DateCreated = person1.DateCreated; ComparisonResult result = compareLogic.Compare(person1, person2); if (!result.AreEqual) Console.WriteLine(result.DifferencesString); Interface for mocking Compare two objects of the same type to each other. Check the Differences or DifferencesString Properties for the differences. Default MaxDifferences is 1 for performance True if they are equal Reflection properties and fields are cached. By default this cache is cleared automatically after each compare. The default configuration Set up defaults for the comparison Pass in the configuration Compare two objects of the same type to each other. Check the Differences or DifferencesString Properties for the differences. Default MaxDifferences is 1 for performance True if they are equal Reflection properties and fields are cached. By default this cache is cleared automatically after each compare. The default configuration Obsolete Use CompareLogic instead Obsolete Use CompareLogic instead Obsolete Use CompareLogic.Compare instead Obsolete Use CompareLogic.ClearCache instead Obsolete Use CompareLogic.Config.ShowBreadcrumb instead Obsolete Use CompareLogic.Config.MembersToIgnore for members or CompareLogic.Config.ClassTypesToIgnore instead Obsolete Use CompareLogic.Config.MembersToInclude or CompareLogic.Config.ClassTypesToInclude instead Obsolete Use CompareLogic.Config.CompareStaticProperties instead Obsolete Use CompareLogic.Config.CompareStaticFields instead Obsolete Use CompareLogic.Config.CompareChildren instead Obsolete Use CompareLogic.Config.CompareReadOnly instead Obsolete Use CompareLogic.Config.CompareFields instead Obsolete Use CompareLogic.Config.IgnoreCollectionOrder instead Obsolete Use CompareLogic.Config.CompareProperties instead Obsolete Use CompareLogic.Config.MaxDifferences instead Obsolete Use the ComparisonResult.Differences returned from CompareLogic.Compare Obsolete Use the ComparisonResult.DifferencesString returned from CompareLogic.Compare Obsolete Use CompareLogic.Config.AutoClearCache instead Obsolete Use CompareLogic.Config.Caching instead Obsolete Use CompareLogic.Config.AttributesToIgnore instead Obsolete Use CompareLogic.Config.IgnoreObjectTypes instead Obsolete Use CompareLogic.Config.CustomComparers instead Obsolete Use CompareLogic.Config.CustomComparers instead Obsolete Use CompareLogic.Config.ExpectedName instead Obsolete Use CompareLogic.Config.ActualName instead Obsolete Use CompareLogic.Config.DifferenceCallback instead Obsolete Use CompareLogic.Config.CollectionMatchingSpec instead Compare Parameters The configuration settings The type of the first object The type of the second object Details about the comparison A reference to the parent object1 A reference to the parent object2 The first object to be compared The second object to be compared The breadcrumb in the tree Configuration Default Constructor Reset the configuration to the default values Ignore millisecond differences between DateTime values or DateTimeOffset values. The default is 0 (any time difference will be shown). When comparing struct, the depth to compare for children. The default is 2 If true, unknown object types will be ignored instead of throwing an exception. The default is false. If true, invalid indexers will be skipped. The default is false. If a class implements an interface then only members of the interface will be compared. The default is all members are compared. Show breadcrumb at each stage of the comparision. The default is false. This is useful for debugging deep object graphs. A list of class types to be ignored in the comparison. The default is to compare all class types. Only these class types will be compared. The default is to compare all class types. Ignore Data Table Names, Data Table Column Names, properties, or fields by name during the comparison. Case sensitive. The default is to compare all members. MembersToIgnore.Add("CreditCardNumber") Only compare elements by name for Data Table Names, Data Table Column Names, properties and fields. Case sensitive. The default is to compare all members. MembersToInclude.Add("FirstName") If true, static properties will be compared. The default is true. If true, static fields will be compared. The default is true. If true, child objects will be compared. The default is true. If false, and a list or array is compared list items will be compared but not their children. If true, compare read only properties (only the getter is implemented). The default is true. If true, compare fields of a class (see also CompareProperties). The default is true. If true, compare each item within a collection to every item in the other. The default is false. WARNING: setting this to true significantly impacts performance. If true, compare properties of a class (see also CompareFields). The default is true. The maximum number of differences to detect. The default is 1 for performance reasons. The maximum number of differences to detect when comparing byte arrays. The default is 1. Reflection properties and fields are cached. By default this cache is cleared after each compare. Set to false to keep the cache for multiple compares. By default properties and fields for types are cached for each compare. By default this cache is cleared after each compare. A list of attributes to ignore a class, property or field AttributesToIgnore.Add(typeof(XmlIgnoreAttribute)); If true, objects will be compared ignore their type diferences. The default is false. In the differences string, this is the name for expected name. The default is: Expected In the differences string, this is the name for the actual name. The default is: Actual Callback invoked each time the comparer finds a difference. The default is no call back. Sometimes one wants to match items between collections by some key first, and then compare the matched objects. Without this, the comparer basically says there is no match in collection B for any given item in collection A that doesn't Compare with a result of true. The results of this aren't particularly useful for object graphs that are mostly the same, but not quite. Enter CollectionMatchingSpec The enumerable strings should be property (not field, for now, to keep it simple) names of the Type when encountered that will be used for matching You can use complex type properties, too, as part of the key to match. To match on all props/fields on such a matching key, Don't set this property (default comparer behavior) NOTE: types are looked up as exact. e.g. if foo is an entry in the dictionary and bar is a sub-class of foo, upon encountering a bar type, the comparer will not find the entry of foo A list of custom comparers that take priority over the built in comparers If true, string.empty and null will be treated as equal. The default is false. The precision to compare double values. The default is 0. Details about the comparison Set the configuration for the comparison Keep track of parent objects in the object hiearchy Add parent, handle references count Remove parent, handle references count Keep track of the depth of structs being compared. Used with ComparisonConfig.MaxStructDepth Configuration The differences found during the compare The differences found in a string suitable for a textbox Returns true if the objects are equal Returns true if the number of differences has reached the maximum Detailed information about the difference Item and property name only The type and index of what is compared Nicely formatted string Name of Expected Object Name of Actual Object Returns the parent property name The breadcrumb of the property leading up to the value The child property name Object1 Value as a string Object2 Value as a string The type of the first object The type of the second object A reference to the parent of object1 A reference to the parent of object2 Object1 as a reference Object2 as a reference Prefix to put on the beginning of the message Exclude types depending upon the configuration Returns true if the property or field should be excluded Check if the class type should be excluded based on the configuration Check if any type has attributes that should be bypassed Logic for comparing lists that are out of order based on a key Common functionality for all Comparers Add a breadcrumb to an existing breadcrumb Comparison configuration The existing breadcrumb The field or property name The new breadcrumb Add a breadcrumb to an existing breadcrumb The comparison configuration The existing breadcrumb The property or field name Extra information to output after the name The index for an array, list, or row The new breadcrumb Add a breadcrumb to an existing breadcrumb Comparison configuration The existing breadcrumb The field or property name Extra information to append after the name The index if it is an array, list, row etc. The new breadcrumb Add a difference for the current parameters Add a difference to the result The difference to add to the result The comparison result Convert an object to a nicely formatted string Initializes a new instance of the class. The root comparer. Compares the enumerators and ignores the order Create a CSV file of the differences and launch the default CSV handler (usually Excel) Defines a Single File Report Output the differences to a stream A list of differences Where to write to Output the differences to a string A list of differences A string Output the differences to a stream A list of differences An output stream Output the differences to a string A list of differences A string Escape special characters Report for showing differences to an end user Initializes a new instance of the class. Output the differences to a stream A list of differences Where to write to Output the differences to a string A list of differences A string The text in between the values. Defaults to: CHANGED TO -> The base comparer which contains all the type comparers Compare two objects A list of the type comparers Factory to create a root comparer Get the current root comparer Methods for manipulating strings Insert spaces into a string OrderDetails = Order Details 10Net30 = 10 Net 30 FTPHost = FTP Host Common functionality for all Type Comparers Protected constructor that references the root comparer If true the type comparer will handle the comparison for the type The type of the first object The type of the second object Compare the two objects A reference to the root comparer as newed up by the RootComparerFactory Compare two byte arrays Protected constructor that references the root comparer The root comparer. If true the type comparer will handle the comparison for the type The type of the first object The type of the second object true if it is a byte array; otherwise, false. Compare two byte array objects Compare two objects of type class Constructor for the class comparer The root comparer instantiated by the RootComparerFactory Returns true if the both objects are a class The type of the first object The type of the second object Compare two classes Compare dates with the option to ignore based on milliseconds Constructor that takes a root comparer Returns true if both types are DateTime Compare two DateTime variables Compare DateTimeOffsets with the ability to ignore millisecond differences Constructor that takes a root comparer Returns true if both types are DateTimeOffset Compare two DateTimeOffset Logic to compare two dictionaries Constructor that takes a root comparer Returns true if both types are dictionaries The type of the first object The type of the second object Compare two dictionaries Compare Double values with the ability to specify the precision Constructor that takes a root comparer Returns true if both types are double Compare two doubles Logic to compare to enum values Constructor with a default root comparer Returns true if both objects are of type enum The type of the first object The type of the second object Compare two enums Logic to compare two LINQ enumerators Constructor that takes a root comparer Returns true if either object is of type LINQ Enumerator The type of the first object The type of the second object Compare two objects that implement LINQ Enumerator Compare all the fields of a class or struct (Note this derrives from BaseComparer, not TypeComparer) Constructor with a root comparer Compare the fields of a class Logic to compare two hash sets Constructor that takes a root comparer Returns true if both objects are hash sets The type of the first object The type of the second object Compare two hash sets Logic to compare an integer indexer (Note, inherits from BaseComparer, not TypeComparer) Constructor that takes a root comparer Compare an integer indexer Compare objects that implement IList Constructor that takes a root comparer Returns true if both objects implement IList The type of the first object The type of the second object Compare two objects that implement IList Logic to compare to pointers Constructor that takes a root comparer Returns true if both types are a pointer The type of the first object The type of the second object Compare two pointers Compare two properties (Note inherits from BaseComparer instead of TypeComparer Constructor that takes a root comparer Compare the properties of a class Logic to compare two runtime types Constructor that takes a root comparer Returns true if both types are of type runtme type Compare two runtime types Compare primitive types (long, int, short, byte etc.) and DateTime, decimal, and Guid Constructor that takes a root comparer Returns true if the type is a simple type The type of the first object The type of the second object Compare two simple types Compare two strings Constructor that takes a root comparer Returns true if both objects are a string or if one is a string and one is a a null The type of the first object The type of the second object Compare two strings Compare two structs Constructor that takes a root comparer Returns true if both objects are of type struct Compare two structs Logic to compare two timespans Constructor that takes a root comparer Returns true if both objects are timespans The type of the first object The type of the second object Compare two timespans Compare two URIs Constructor that takes a root comparer Returns true if both types are a URI The type of the first object The type of the second object Compare two URIs Methods for detecting Returns true if it is a byte array Returns true if the type can have children True if the type is an array Returns true if it is a struct Returns true if the type is a timespan Return true if the type is a class Return true if the type is an interface Return true if the type is a URI Return true if the type is a pointer Return true if the type is an enum Return true if the type is a dictionary Return true if the type is a hashset Return true if the type is a List Return true if the type is an Enumerable Return true if the type is a Double Return true if the type is a DateTime Return true if the type is a DateTimeOffset Return true if the type is a string Return true if the type is a primitive type, date, decimal, string, or GUID Returns true if the Type is a Runtime type