-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ignore collection count #256
ignore collection count #256
Conversation
Thanks for the pull request submission. This implementation is going to confuse people later. If the counts are different and one list is longer than the other then the longer list items will not be compared. Please make a IReadOnlyCollectionComparer and ignore the count when CompareReadOnly == false |
I am thinking that maybe the IReadOnlyCollection would not be compared at all if CompareReadOnly == false |
…n/Compare-Net-Objects into ignore-collection-count # Conflicts: # Compare-NET-Objects-Tests/IgnoreTests.cs
I just realised that your last comment suggests ignoring the entire collection, but I am hoping to have the functionality of just ignoring the |
Now this is just a defect that is specific to a read only collection. What I would do is simply this:
var differencesWithoutCount = Differences.Where(o => o.ChildPropertyName != "Count" && !o.Object1TypeName.Contains("ReadOnlyCollection")); |
Ye that is my current approach, but I'm not a huge fan because I then need to specify the same for every type of collection I might be using in my classes I just thought that it made sense to exclude I can always just add the filter for any collection type I happen to be using |
Updated the PR to simply ignore ReadOnlyCollections when |
No description provided.