Objects in this mirror are closer to Microsoft Technologies. DNM objective is to help users on Microsoft technologies by providing Articles, snippets, Interview Questions.

04 January 2008

Option in VB.Net

In VB Compiler has options like

1. Option Strict: on/off
Restricts implicit data type conversions to only widening conversions.
If used, the Option Strict statement must appear in a file before any other source code statements.
Visual Basic allows conversions of many data types to other data types. Data loss can occur when the value of one data type is converted to a data type with less precision or smaller capacity. A run-time error occurs if such a narrowing conversion fails. Option Strict ensures compile-time notification of these narrowing conversions so they can be avoided.
In addition to disallowing implicit narrowing conversions, Option Strict generates an error for late binding. An object is late bound when it is assigned to a variable that is declared to be of type Object.
Because Option Strict On provides strong typing, prevents unintended type conversions with data loss, disallows late binding, and improves performance, its use is strongly recommended.

2. Option Comapre: Binary/Text
Forces explicit declaration of all variables in a file.
Binary :Optional. Results in string comparisons based on a sort order derived from the internal binary representations of the characters.
Text :Optional. Results in string comparisons based on a case-insensitive text sort order determined by your system's locale.

3. Option Explicit: on/off
Forces explicit declaration of all variables in a file.

The options will not avaliable in C#.

0 Comments:

Post a Comment