C# Object comparison problem
- Status: Closed
- Prize: €15
- Entries Received: 1
- Winner: bojbaj
Contest Brief
I have the following code where I am using KellermanSoftware.CompareNetObjects;
var comparer = new CompareLogic
{
Config =
{
MaxDifferences = int.MaxValue
}
};
if (fieldsToIgnore != null)
comparer.Config.MembersToIgnore = fieldsToIgnore;
var differences = comparer.Compare(Expected, output).Differences;
I can use later, these properties.
difference.PropertyName
difference.Object1Value
difference.Object2Value
I would like to have a method which would give equals, where I could use these properties e.g.
var equals = comparer.Compare(Expected, output);
And then use this equals list to call the same:
equals .PropertyName
equals .Object1Value
equals .Object2Value
Object can be very broad an example:
"Output": {
"SingleResult": {
"Count": 1,
"Feature": [
{
"Option1": { },
"Option2": "1",
"Option3": [],
"Option4": {},
}
],
"SomeField":"None"
...
}
"Object2": {
"Table": [
{"field1":["El1", "El2"]}
...
]
},
"Object3": : {
"Table": [
{"field1":["El1", "El2"]}
...
]
},
"Object4": {
"Table": [
{"field1":["El1", "El2"]}
...
]
}
}
Can this be done with KellermanSoftware.CompareNetObjects? Need a light weight solution.
Recommended Skills
Top entries from this contest
-
bojbaj Turkey
Public Clarification Board
How to get started with contests
-
Post Your Contest Quick and easy
-
Get Tons of Entries From around the world
-
Award the best entry Download the files - Easy!