[Mono-list] Problem with the 'is' operator, a bug in the mono
runtime??
Dwivedi , Ajay Kumar
AjayKumar.Dwivedi@dresdner-bank.com
Thu, 27 Jun 2002 11:08:48 +0100
> if (modem is ISpherical)
> {
> ISpherical isModem = (ISpherical) modem;
> modem.Roll();
> }
>
> The problem is that modem does not support the ISpherical
> interface but
> when I compile the program and run it, there is no exception thrown
> telling me it was an invalid cast.
Are you expecing a cast Exception??? the code within the if block
is not run since modem is not a ISpherical.
Try adding an else statement, and see if it gets executed.
HTH,
Ajay