VB .Net Question:
Download Questions PDF

What is the advantage of option strict on?

Answer:

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.

What you can't do with Option Strict On, is accessing members of objects that are not declared as a specific object type. You must have a typed reference.

Download VB .Net Interview Questions And Answers PDF

Previous QuestionNext Question
What is STA in .NET?What do you mean by Serialization and Deserialization and its use?