Strict On/Off

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi,

I generally like to be very tight with my type casting and matching,
so I like the use Option Strict On.

However, I am coming across some needs where I would to turn it off.

As far as I can see, the compiler doesn't support turning it off/on
between code lines.

If this possible?

I guess I can break up the code and put these parts in a new module
where I know the type casting is safe and use Option Strict off but
is it possible with some other method?

Thanks

--
 
Mike,

The partial class can be your friend in this, although I have never that I
cannot cast.

Cor
 
Mike,

The partial class can be your friend in this, although I have never that I
cannot cast.

Cor
 
Mike said:
I generally like to be very tight with my type casting and matching, so I
like the use Option Strict On.

However, I am coming across some needs where I would to turn it off.

As far as I can see, the compiler doesn't support turning it off/on
between code lines.

If this possible?

Unfortunately no. You can only turn it on/off on a member basis by using a
partial class and setting 'Option Strict On'/'Option Strict Off' for each of
the partial type declarations.

I tend to use this approach when dealing with COM Interop scenarios such as
in Office programming.
 
Mike said:
I generally like to be very tight with my type casting and matching, so I
like the use Option Strict On.

However, I am coming across some needs where I would to turn it off.

As far as I can see, the compiler doesn't support turning it off/on
between code lines.

If this possible?

Unfortunately no. You can only turn it on/off on a member basis by using a
partial class and setting 'Option Strict On'/'Option Strict Off' for each of
the partial type declarations.

I tend to use this approach when dealing with COM Interop scenarios such as
in Office programming.
 
Herfried said:
Unfortunately no. You can only turn it on/off on a member basis by
using a partial class and setting 'Option Strict On'/'Option Strict Off'
for each of the partial type declarations.

I tend to use this approach when dealing with COM Interop scenarios such
as in Office programming.

Ok, thanks Herfried and Cor for the tip.

--
 
Herfried said:
Unfortunately no. You can only turn it on/off on a member basis by
using a partial class and setting 'Option Strict On'/'Option Strict Off'
for each of the partial type declarations.

I tend to use this approach when dealing with COM Interop scenarios such
as in Office programming.

Ok, thanks Herfried and Cor for the tip.

--
 
Back
Top