VB.NET 10 : Optional Nullable Parameter

VB.NET 10 : Optional Nullable Parameter

  • Comments 0

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!!!

Leave a Comment
  • Please add 7 and 6 and type the answer here:
  • Post