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

View More Entries

Public Clarification Board

  • Samrat0
    Samrat0
    • 3 years ago

    please check and determine that price #1

    • 3 years ago
  • StrongDecs
    StrongDecs
    • 3 years ago

    Hi, Increase price pls. Thanks,

    • 3 years ago

How to get started with contests

  • Post your contest

    Post Your Contest Quick and easy

  • Get tons of entries

    Get Tons of Entries From around the world

  • Award the best entry

    Award the best entry Download the files - Easy!

Post a Contest Now or Join us Today!