Wednesday, 17 July 2013

Option statements in vb.net

Vb.net provides three types options statements
Option Explicit On/Off:This option is used to specify weather variable declaration is mandatory in vb.net .By default this option was set  to "ON"that indicates you must declare the variable before using it.When this option was set to "OFF" you can use a variable with out declaring it and in this case the type f variable will be object and it can be store any type of value
Option Explicit off
module module1
sub main()
s1="jyothi"
End sub
End module

Option Strict On/Off
This option is used to specify whether type casting is done implicitly by vb.net or user has to perform manual. By default this option was set to "OFF" indicating vb.net will
implicitly perform typecasting and when this was set to "ON" then user must perform the typecasting manual
Option Strict on
Dim s1 As string="test"
Dim n As Integer=int.Parse(s1)

Option Compare Text/Binary:
This option  is used to specify how the strings will be compared.By default this option is set to "binary" that indicates string will be compared with case sensitivity when this option was set "TEXT" string will be compared with out case sensitivity

Option Compare Text
Dim s1 As string="JYOTHI"
Dim s1 As string="Jyothi"
console.WriteLine(s1=s2)

No comments:

Post a Comment