Vincent Parrett 750 Posted April 10, 2020 (edited) Is it possible to determine if a record type has an equality operator overload? I'm scratching my head on this one, not sure if there's enough info in the rtti or I'm just not looking at the right thing. Use case, I need to compare if two records are equal (this is for DUnitX & Delphi-Mocks). Of course due to managed types etc it's not as simple as it seems.. however if the record has an Equals or NotEquals operator overload then I could use that. Edited April 10, 2020 by Vincent Parrett Share this post Link to post
David Heffernan 2345 Posted April 10, 2020 I think it has a name something like &op_Equality. You should be able to enumerate the methods of the type. Share this post Link to post
Uwe Raabe 2057 Posted April 10, 2020 Indeed, it is a method with MethodKind = mkOperatorOverload. Share this post Link to post
Vincent Parrett 750 Posted April 10, 2020 Thanks guy's, I think that should be enough to get me going. Share this post Link to post
Stefan Glienke 2002 Posted April 20, 2020 https://bitbucket.org/sglienke/spring4d/src/409cf53e4848815ac089763243469226b363d3be/Source/Base/Spring.pas#lines-3806 1 Share this post Link to post
Vincent Parrett 750 Posted April 20, 2020 @Stefan Glienke thanks.. I didn't even think to look at spring, and yet I use it every day! Share this post Link to post