Monday, January 18, 2010

Optional Nullable Parameter introduced in VB.NET 10

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

Share This!


1 comment:

Anonymous said...

It's an remarkable piece of writing for all the internet
visitors; they will get advantage from it I am sure.

Powered By Blogger · Designed By Seo Blogger Templates