Skip to content
Greg Finzer edited this page Aug 29, 2023 · 10 revisions

Q: One thing im not sure how to accomplish is to actually get which items have been added or removed when comparing? It shows the count is different but i dont see how to actually get the needed items. any clue?

A: Set Config.IgnoreCollectionOrder to false

Q: I would like to report a defect. I have an object with many differences and it is only reporting one difference.

A: By default for performance reasons, Compare .NET Objects only detects the first difference. To capture all differences set Config.MaxDifferences to the maximum differences desired.

Q: I want to show all the differences in my list of objects. If the lists are different counts, it doesn't compare everything. How can I compare it?

A: Set Config.MaxDifferences to the maximum difference desired. Set Config.IgnoreCollectionOrder to true. If you have a primary key for the class, make sure to define a Config.CollectionMatchingSpec.

Q: What if I don't want to compare everything?

A: Add the names of class types to the Config.ClassTypesToIgnore or add the names of members to the Config.MembersToIgnore. If you need something more complex, you can always implement your own custom comparer. See Custom Comparers.

Q: Do we have any config exposed to ignore string cases while comparison ?

A: Yes. Set Config.CaseSensitive = false.

Q: I would like to know if it is possible to provide a wildcard for membernames to ignore, or if that is possible to provide a member ignore callback?

A: Yes. Specify the * for the wildcard.

Q: I am curious what license this is offered under. Is it commercial or completely open-sourced?

A: See https://github.com/GregFinzer/Compare-Net-Objects/wiki/Licensing

Q: How to create/install a Custom Comparer?

A: See the help topic Custom Comparer in the Help File: https://github.com/GregFinzer/Compare-Net-Objects/blob/master/Compare-NET-Objects-Help/Compare-NET-Objects-Help.chm?raw=true

Q: The collection matching spec is not matching an inner child. How can this work?

A: The collection matching spec only matches the id on the list, not in a child. See: https://github.com/GregFinzer/Compare-Net-Objects/issues/68

Q: I am overriding equals using Compare .NET Objects and I am getting a stack overflow exception. When can you fix this?

A: Compare .NET Objects uses a reference equals to keep track of parent and child objects. To use the hashcode instead, set the Config.UseHashCodeIdentifier = true. See: https://github.com/GregFinzer/Compare-Net-Objects/wiki/Overriding-Equals