Here is a list of some of the more prominent new features that I've encountered in the Visual Basic 2010. This is not a major release so the new features are mostly useful but not Earth-shattering.
Here are the biggest additions. The most useful of these are explained in my book Visual Basic 2010 Programmer's Reference.
- • Auto-implemented properties
- These let you make properties without specifying get and set procedures. Visual Basic automatically makes properties using backing store variables just as you would. Later you can add the get and set procedures if you want to turn them into a regular property. For example, the following code makes a FirstName property.
Public Property Name As String
- • Array literals
- Now you don't need to use the New keyword to create an array on the fly. For example:
Dim numbers[] As Integer = {1, 2, 3};
- • Collection initializers
- These let you initialize collections much as you can initialize arrays. For example, the following code initializes a List(Of String).
Dim pies As New List(Of String) From {
"Apple", "Cherry", "Banana", "Pickle" }
- • Implicit line continuation
- In many (buit not all) cases, Visual Basic can deduce that a statement is not complete and it doesn't require an explicit line continuation character in those places. Two common places where it can tell that a statement is not complete are in the parameters being passed to a method and in a method declaration. For exampe, the following declaration is now allowed.
Public Sub DoSomething(
ByVal number_of_items As Integer,
ByVal number_of_customers As Integer,
)
End Sub
- • Multiline Lambda Subroutines
- You can now make multi-line lambda subroutines in addition to functions.
- • Co-variance and contra-variance
- These are so technoical that I'm not even going to bother describing them. See:
this post and
this post.
- • No PIA
- You can now deploy Office applications without including primary interop assemblies (PIAs).
- • Dynamic language support
- Improved support for binding with dynamic languages such as IronRuby and IronPython (See John Mueller's book
"Professional IronPython.)
Visual Studio 2010 also includes some new features. The following list summarizes my favorites.
- • Generate from usage
- You can write code that invokes a method (or property, field, class, etc.) that doesn't yet exist. Then you can use automatic correction options to generate a stub for the method.
- • Reference highlighting
- When you set focus on a symbol, Visual Studio highlights all references to that symbol. (This can be a little distracting at first.) Use Shift+Down and Shift+Up to move to the next/previous instances of the symbol.
For a bit more information about some of these features, see
this blog entry,
this MSDN library entry, or just google around a bit.
|