Deserializing JSON into a Dynamic Object

Deserializing in JSON.NET can be dynamic using the JObject class, which is included in that library. My JSON string represents these classes:
A normal conversion to string and back can be done easily:
Now we deserialize WITHOUT referencing the Foo class directly:
Or if you want to go deeper:

Read More

Comparing C# Objects

There are times when you need to compare objects. Microsoft includes a built-in Equals function. When it comes to comparing instantiated objects it will return False unless the two objects are the result of the same instantiation. If your definition of equality is the two objects of the same type with the same property values then you need to implement a different approach. I typically serialize the object then compare the string values.

The JsonConvert object is included with the Json.NET nuget.

Read More