compare private members of two class instances

  • Thread starter Thread starter Avi
  • Start date Start date
A

Avi

Hi all,

I have two instances of the same class. Is it possible to compare private
members of two classes and to come with a list of differences?

Thanks,
Avi
 
Not from outside of the class. You should make a public method on the class
which takes an instance of the class, and compares it to the instance. The
ICompare interface is used for sorting, among other things, and is an example
of this mechanism.
 
Family Tree Mike said:
Not from outside of the class. You should make a public method on the
class
which takes an instance of the class, and compares it to the instance.
The
ICompare interface is used for sorting, among other things, and is an
example
of this mechanism.

Alternatively reflection can let you read private members of any object *if*
you have the security privileges to do so.
 
Back
Top