IIf works with any expression that evaluates into a boolean. As Christian said, the test doesn't check whether the images represent the same picture but rather whether the variables refer to the
same object instance[
^].
You could write a Method Extension to compute the hash of the image, and base your comparison on that :)