Pages

Men

rh

7/01/2012

What do you mean by 'Option Strict On' ?

What do you mean by 'Option Strict On' ?
Option Strict
Visual Basic language in general does not require explicit syntax to be used when performing operations that might not be optimally efficient (e.g. late binding) or that might fail at run time (e.g. narrowing conversions). This permissive semantics often prevents detection of coding errors and also affects the performance of the application.

VB.NET enables a programmer to enforce strict semantics by setting this option to "On". When used, this option should appear before any other code. This option can be set to "On" or "Off". If this statement is not specified, by default, it is set to "Off".

Syntax: Option Strict [On / Off]
When it is set to "On", it disallows any narrowing conversions to occur without an explicit cast operator, late binding and does not let the programmer omit "As" clause in the declaration statement. Since setting it to "On" requires explicit conversion, it also requires that the compiler be able to determine the type of each variable. Thus it is implied that Option Strict also means Option Explicit.

No comments :

Post a Comment