Welcome to MSDN Blogs Sign in | Join | Help

Wriju's BLOG

.NET and everything
VB.NET 10 : Optional Nullable Parameter

If you want to assign Nothing to the optional parameter in VB.NET 10, it is just like to obvious now,

Sub Main()

    'Passing value for the optional parament _age

    MyFunc("Wriju", "wriju@contoso.com", 30)

 

    'No value is supplied for the optional parament _age

    MyFunc("Writam", "writam@contoso.com")

End Sub

 

 

Sub MyFunc(ByVal _name As String,

           ByVal _email As String,

           Optional ByVal _age As Integer? = Nothing)

 

    Console.WriteLine("Name={0}, Email={1}, Age={2}",

                      _name, _email, _age.ToString())

End Sub

 

Namoskar!!!

Posted: Sunday, November 08, 2009 6:56 AM by wriju

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker