The Visual Basic Team - New Language Features in Visual Basic 14
"Visual Basic 14" is the version of Visual Basic that will ship with Visual Studio 2015. In this blog post I'll talk specifically about the VB language improvements in this release. (Separately, there are a whole host of IDE and project-system improvements as well). There are two overall themes to the language improvements:
(1) Make common coding patterns a little cleaner, with easy-to-grasp syntax
(2) Fix up some irritating corners of the language that you probably already expected to work.
This release will be easier to digest than was Visual Basic 12, with its introduction of async! (The version number of Visual Basic has gone straight from 12 to 14, skipping 13. We did this to keep in line with the version numbering of Visual Studio itself.)
I'll only talk here about the most important new language features. For a full exhaustive list, look at roslyn.codeplex.com > Documentation > Language Features.
(Note: I've used animated gifs in this blog-post because the language features shine the best when you see them in action. The longest gif is only 8 seconds so if you miss the start, keep watching! If you don't like the animation, please see the version of this post with still before/after pictures.
The ?. operator
The new ?. operator is an easier way to check whether something is null before dotting into it. ...
The NameOf operator ...
String Interpolation
String interpolation is my favourite feature this release. I know that ?. is more powerful, and nameof() will make my code more robust, but every time I type an interpolated string it gives me a little shiver of excitement! Here's how it looks: ...
Multiline Strings
You used to have to use cumbersome workarounds to get multiline strings in VB. Thankfully VB14 now supports multiline strings literals directly: ...
Readonly Auto-properties
We've made it considerably easier to write readonly auto-properties. Here's how you do it:...
Comments
Comments are now handled better in statements that split over multiple lines. This is particularly nice for LINQ expressions. Look at these "before" and "after" videos... previously it was simply an error to include these comments: ...
Love to see VB continue to get some love... :)
No comments:
Post a Comment
NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...
ALL comments are moderated. I will review every comment before it will appear on the blog.
Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...
I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...
Please see my comment policy for more information if you are interested.
Thanks,
Greg
PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...