in

vbCity Blogs

New (temp) place for vbCity Blogs

CanOz Blog

Neil Knobbe's place for Visual Basic.NET and WPF

November 2008 - Posts

  • End of line continuation characters in 2010

     Another change announced at PDC 2008, and a seriously great improvement, to Visual Basic in the next version is the end of the requirement of the line continuation character. 

    You all know the one that I mean.  The underscore character ( _ ) that we have used for years to put our long lines of code on multiple lines. 

        Public Sub DoIt(ByVal opt1 As String, ByVal opt2 As String, _

                        ByVal opt3 As Integer, ByVal opt4 As Double, _

                        ByVal opt5 As String)

            ' code here

     

        End Sub

     VB will now have implicit line continuation characters.  Which means that code over multiple lines will now look like:

        Public Sub DoIt(ByVal opt1 As String, ByVal opt2 As String,

                        ByVal opt3 As Integer, ByVal opt4 As Double,

                        ByVal opt5 As String)

            ' code here

     

        End Sub

     

  • New to Visual Basic 2010

     So just what is coming to Visual Basic with the next version?

    The short answer is Lots!

    Announced at PDC 2008, one aspect that is coming, and one that I am looking forward to, is auto-implemented properties.

    Just what is that?  Gone are the days where you have to hard code in a getter and setter for custom properties in Classes.

    As it stands now you would have:

    Private m_someField As String

     

        Public Property someField() As String

            Get

                Return m_someField

            End Get

            Set(ByVal value As String)

                m_someField = value

            End Set

        End Property

     Look familier?

    Well now you can have it all in one line of code.

    Public Property someField As String

     It even gets better.  You can also add a default value for your property on the same line too.

    Public Property someField() As String = ""

     This will make coding custom Classes so much easier and faster.

     

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