I have two Json objects as below need to be compared. I am using Newtonsoft libraries for Json parsing.
string InstanceExpected = jsonExpected;
string InstanceAc
After you deserialize the json to C# object the correct way is to implement the IComparable interface in the deserialized class and compare the 2 objects.
So:
using System;
using System.Collections.Generic;
class MyObj : IComparable
{
public string Name { get; set; }
public string ObjectID { get; set; }
public int CompareTo(MyObj other)
{
if ((this.Name.CompareTo(other.Name) == 0) &&
(this.ObjectID.CompareTo(other.ObjectID) == 0))
{
return 0;
}
return -1;
}
}