in

vbCity Blogs

New (temp) place for vbCity Blogs

Mike McIntyre's .NET Journal

Visual Basic 2010 - Nullable Optional Parameters

 Nullable types were a welcome addition to Visual Basic 2008.  In Visual Basic 2010 you can use them as parameters.  Here are two examples:

    ' Assign Nothing as the default value for nullable optional parameter.

    Sub Add(ByVal x As Integer, ByVal y As Integer, Optional ByVal z As Integer? = Nothing)

        ' code removed for brevity

    End Sub

 

    ' Assign an integer value to a nullable optional paramter of type Double.

    Sub Process(ByVal x As Integer, ByVal y As Integer, Optional ByVal z As Double? = 4)

        ' code removed for brevity

    End Sub

 

Mike McIntyre's .Net Journal

getdotnetcode.com

About Mike McIntyre

I  am a programmer, developer, and system architect with 29+years experience including state-of-the-art application development frameworks and languages including Visual Studio versions 2002-2010, .NET Framework versions 1-4, C#, and Visual Basic.

I am a mentor, trainer, and coach in the Microsoft .NET technical community. DevCity is my favorite community site. You can find examples of my involvement with DevCity in the site articles, newsletter articles, and my posts in the forum.

Since 2002 I have hosted a .NET site at http://www.getdotnetcode.com, a place with free and inexpensive Visual Basic and C# source code that can be purchased on an 'as needed' basis.

In 2007 I established a .NET search engine, 'Resources for .NET Developers' at http://dot-net-resources-swicki.eurekster.com

Copyright 1998-2009 vbCity.com LLC
Powered by Community Server (Non-Commercial Edition), by Telligent Systems