In previous versions of VB.Net, in order to create a property, it was necessary to create a private field for the property and to refer to it in the Get/Set sections of the property. It was a lot of code to write for each and every property you created. In VB.Net 2010, this is no longer necessary due to the new Auto-Implemented Properties feature. This is similar to the automatic properties implemented in C# in 2008.


For instance, previously (VS.Net 2008 and before), a property looked like this:

   Private _name As String
    Public Property Name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            _name = value
        End Set
    End Property

Now, in VB.Net 2010, you can do all of this in one line:

Property Name as String

The Get and Set methods are automatically generated in the background, as well as the Private field (the name of the property preceded by an underscore). You can use the field with the preceding underscore in your code, but you can’t create it as New, otherwise it will throw an error.

If you’d like, you can give the property an intial value also:

Property Name as String = "Abraham Lincoln"

This is a huge and helpful change which reduces the amount of code by a great deal and makes it a lot easier to read.