Delphi / Object Pascal · Exception
What does EIntfCastError Exception mean in Delphi / Object Pascal?
Raised when an illegal cast is attempted on an interface reference - for example using 'as' to cast a variable to an interface the underlying object doesn't implement.
Raised when an illegal cast is attempted on an interface reference - for example using 'as' to cast a variable to an interface the underlying object doesn't implement.
Use Supports() to test for interface support and get a safely-typed reference back instead of an unconditional 'as' cast, particularly when working with objects obtained from a factory or plugin boundary where the concrete type isn't guaranteed.