Re: knowing the interfaces that an object implements



If the connection variable is declared as Object the VB compiler
unfortunately does not complain even with Option Explicit on. This is one of
the "features" of VB.net (and one of the reasons that I prefer C# :-))

Regards, Jakob.


"Jon Skeet [C# MVP]" wrote:

> Nick Hall <nickh@xxxxxxxxxxxxxxxxxx> wrote:
> > It's not evaluated until runtime - therefore it actually does work. It uses
> > the IL instruction isinst to make the determination.
>
> The "if" does, but the call to Dispose should fail at compile time,
> because the compiler doesn't know that connection implements
> IDisposable. Of course, with Option Strict turned off it would be okay,
> but personally I think type-safety is rather important :)
>
> --
> Jon Skeet - <skeet@xxxxxxxxx>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too
>
.



Relevant Pages

  • Re: Option Explicit Statement
    ... > to add an option explicit statement at the beginning of my code. ... the compiler can catch miss-spelled variable names. ... the older legacy style basic (in fact, VBA has it roots in QuickBasic). ... PUBLIC SUB TEST1 ...
    (microsoft.public.access.formscoding)
  • Re: Option Explicit not working
    ... Option Explicit must be present in ALL modules where you want variables to ... > a simple Dim of a string.. ... > In options the "Require Variable Declaration" is set. ... > hey presto the compiler finds the undeclared variable.... ...
    (microsoft.public.access.modulesdaovba)
  • Re: Runtime error with vba and checkbox
    ... "Option Explicit" goes at the top of the module. ... It's a signal to the compiler that you want to be forced to declare your ... Do you need linked cells for ... improved error states: ...
    (microsoft.public.excel.programming)
  • Re: Doing MS Training in Excel, having Macro Issue
    ... You probably have an 'Option Explicit' line at the top of the code module. ... If you omit the Option Explicit declaration, the compiler will create an instance of the variable when it is first encountered in code. ...
    (microsoft.public.excel.misc)
  • Re: Seeting malloc pointer to NULL [2] -Totally confused!!!!!
    ... Best regards ... So now that I have gotten it to work in the VC++ compiler, ... mayby my compiler doesn't support pointers to pointers! ... from void* to other pointer types. ...
    (microsoft.public.vc.language)