In previous editions like .net framework 2.0/3.0/3.5 we were not able to create a Optional parameter as a nullable in vb.net. but now its time to get happy. you can create Nullable Optional Parameter in VB.NET 10.
eg:
Sub MyFunc(ByVal _name As String, ByVal _email As String, Optional ByVal _age As Integer? = Nothing)
your code
end sub
Benefit: The benefit of Nullable Optional Parameter is that if you want to pass value then it will take value if you will not pass value then it will take 'Nothing' in that parameter then before using that parameter you can easily check that value is Nothing or not
like:
if _age isnot Nothing then
your code
end if
Optional Nullable Parameter introduced in VB.NET 10
Posted by
Rajesh Rolen
at
Monday, January 18, 2010
Labels: VB.NET
0 comments:
Post a Comment