Evan Camilleri wrote:
What is the fastest way to get the 'hash' (or CRC32 or whatever) of the
contents of an object
In both of your questions, you are overloooking a critical detail: there
is no consistent definition of an object's "contents".
You can come the closest, IMHO, for objects that can be serialized.
Then you can serialize them and use the resulting stream of data
(whether it's XML or binary) for your purposes.
But not all objects can be serialized, and unless you're talking about a
struct or class that only has value-type fields as data, there's not a
single block of data that represents the object.
If you can define "contents" in a way that allows you to address your
first question ("memory stream"), then the answer to the second ("hash")
can be discussed (though I think that answering "fastest" is
problematic, since any hash is going to have tradeoffs with respect to
speed versus how you intend to use it...the method that's truly
"fastest" may not work for your purposes).
Without a better definition and criteria for how you want to do this, I
don't think it's really possible to answer your question in a reasonable
way.
Pete