What is the use of Option Infer statement in VB?

 Posted by Ddd on 2/8/2011 | Category: VB.NET Interview questions | Views: 5593 | Points: 40
Answer:

It is used in Visual Basic to determine the data type of a local variable declared without an as clause on the basis of the value assigned to the variable at

compile time.


(type inferencing in VB)

example: Option Infer on (default)
dim a=45
Take the mouse over variable a
a's data type is integer( see in tooltip)

Option Infer off
Take the mouse over variable a
a's data type is Object( see in tooltip)





a's data type is object


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response