I have two dictionaries, and when both dictionaries contain the same keys, I want to see if the values are the same. The problem is that the dictionary values are variants, and the Operator_Compare function won’t get called. I can’t type-cast explicitly because this is a generic comparison function, and it won’t know what types of objects are in the dictionary.
I know that this is the designed behavior for Variants and Operator_Compare but I’m looking for a solution or workaround.
Dim p1, p2 As TRVector2D
p1 = New TRVector2D(1,1)
p2 = New TRVector2D(1,1)
// TRVector2D implements Operator_Compare
Dim bP As Boolean = p1 = p2 // Operator_Compare returns True
Dim v1, v2 As Variant
v1 = p1
v2 = p2
Dim bV As Boolean = v1 = v2 // Operator_Compare not called; returns False
3 posts - 3 participants