https://gist.github.com/undergroundmonorail/f93779d2e14c9839b7d2d8292694b5a2
needed to compare two objects to make sure they were the same after being serialized and deserialized
they didn't define Equals() or anything so i decided to compare all the properties directly
except some of the properties are lists of other classes that also don't have Equals() so i also have to use reflection to make sure all the properties match there
it was actually almost much worse, earlier i was using dynamic variables to try to determine what type a list had in it just from knowing it was a list and then comparing that way but i couldn't quite get it working so i just only check for the two list types i know there are
@monorail
Oh shit. This would seriously tempt me to give up on the type system for this problem.
Use newtonsoft to cast both to jtoken (json) and use the built in jtoken.deepequals()
I'm sure a custom solution executes faster and more bullet proof, but sometimes you just cant even.
@monorail
Hmm, I'm not entirely sure why you couldn't use one deserializer to validate the results of another, but you know the requirements best.
And my way is a sketchy, lazy hack even in the best of times.
Anyway, sorry you had to write all that. I had similar deserialization issues with a polymorphic collection of classes last week that kept matching to the wrong types. Took a few tries to get right. No fun.
@polyphonic i mean it's the same deserializer, which is the problem :P