Lets say I have a class A that inherits from class B in C#. Class B has a property on it called Checksum which, when called at runtime, is to calculate the checksum of all the properties on an instance of class A (the particualr checksum algorithm used is not important, one from the BCL probably).
Importantly, the checksum algorithm must ignore the checksum property otherwise it will fail when validated later (as the checksum value will have changed).
So, as far as I can see it, there are two options:
1) Iterate over all the public properties of the object using reflection, concatenate into a string and checksum that.
2) Pretend that the object is simply a bunch of contiguous memeory addresses and treat that as a byte array and checksum that.
1 - sounds slow 2 - sounds difficult as I am not sure how you're get it to ignore the string that represents the checksum itself, or how references to other objects are handled.
Does anyone have any better ideas than 1 which sounds like the better of these two solutions?