Is there a standard (generic) function that uses RTTI to compare the contents of two class instances and say whether they're the same or not?

Is there a standard (generic) function that uses RTTI to compare the contents of two class instances and say whether they're the same or not?

(I'd like something that lets me assign an attribute to certain fields to be ignored, and then use a loop that compares values based on their type to report if all the other fields match or not, without having to write an if...then for every field in the class. Surely something like this has been written dozens of times by now!)

In this instance, the fields are all built-in types except there's one TStringlist field.

Comments

  1. Lars Fosdal do you have code available to share?

    ReplyDelete
  2. David Schwartz It's tied to proprietary code, but I can attempt to do an extract.

    ReplyDelete
  3. Lars Fosdal That would be helpful, thanks.

    ReplyDelete

Post a Comment