VB 2010 Unveiled at PDC 2008! (Lisa Feigenbaum)

VB 2010 Unveiled at PDC 2008! (Lisa Feigenbaum)

  • Comments 15

Last week at the Professional Developers Conference, we made a number of very exciting announcements regarding the future of Visual Basic. Here is the list of VB 2010 features we've announced:

  • Collection Initializers. Initialize collections in fewer lines of code! Use the "From" keyword followed by a list, rather than successive calls to the Add method.
    • Dim y As New List(Of String) From {"hello", "world"} 
    • Dim x As New Dictionary(Of String, Integer) From {{"hello", 1}, {"world", 2}}
  • Array literals. Express arrays more concisely. Whereas before you used to have to write New Integer() {1,2,3}, now you can just write {1,2,3}. Leave it to the compiler to infer the type of the items in the array! This can be very convenient wherever you use arrays.
    • 2D array: {{1,0},{0,1}}
    • Jagged array: {({1,2,3,4}),({1,2})}
  • Statement lambdas. Visual Basic 2008 enabled lambda expressions. Now you can write multi-line lambda subs or functions as well!
    • Define a Sub or Function anywhere a delegate is expected.
  • Auto-implemented properties. Eliminate 8 out of 9 of the lines you write for boiler-plate VB properties today!
    • Expanded property syntax:
          Private m_Id As Integer
          Public Property Id() As Integer
              Get
                  Return m_Id
              End Get
              Set(ByVal value As Integer)
                  m_Id = value
              End Set
          End Property
    • Auto-property syntax, new in VB 2010:
          Public Property Id() As Integer
    • Auto-property syntax, with an initializer:
          Public Property Id() As Integer = 100
  • Removal of the line continuation character. Underscores are no longer needed in the most common line continuation scenarios. Can you believe it?!?!
    • Attributes, argument lists, parameter lists, queries, and binary operators are some of the most common scenarios for an underscore. In VB 2010, you can now write these lines underscore-free!
    • What are we to do with all those unused underscores? Check out http://www.unemployedunderscores.com
  • Generic co- and contra- variance. Code that used to generate errors will now work error-free! See Lucian Wischik's blog posts on this new feature, which has been enabled by CLR 4.0.
  • No PIA. Deploy your Office applications without the bulky primary interop assemblies! VB 2010 will embed the Office types your application depends on, right into the app itself. No more need to deploy large PIAs.
  • Interop with dynamic languages. VB 2010 offers improved support to interoperate with dynamic languages. Dynamic and static languages each have their own benefits, libraries, and particular scenarios for which they are better suited. With VB 2010, you no longer need to choose just one! You can use dynamic languages directly from VB.Net as needed.

So many exciting features to look forward to! Stay tuned for more blog posts and videos which illustrate these features in more detail.

Leave a Comment
  • Please add 1 and 3 and type the answer here:
  • Post
  • PingBack from http://blog.a-foton.ru/index.php/2008/11/03/vb-2010-unveiled-at-pdc-2008-lisa-feigenbaum/

  • Didn't make it to the PDC? No problem. You can still check out the *hottest* presentation at the Professional

  • I recently blogged about the new VB 2010 language features announced at PDC, as well as the video available

  • I recently blogged about the new VB 2010 language features announced at PDC, as well as the video available

  • Didn't make it to the PDC? No problem. You can still check out the *hottest* presentation at the

  • What about using Nullable(Of Integer) as a optional parameter?

    I'm pretty sure Lucian showed that to me after his talk at the PDC.

  • Thanks for the reminder, Jonathan. Yes, VB2010 allows nullables as optional parameters. Here are some examples.

    Sub a(Optional ByVal x As Integer? = Nothing)

    Sub b(Optional ByVal y As Integer? = 2)

    Sub c(Optional ByVal x As Nullable(Of Integer) = Nothing)

    Sub d(Optional ByVal y As Nullable(Of Integer) = 2)

    Sub e(Optional ByVal z As MyStructure? = Nothing)

  • Please a refactoring to remove all line continuation characters.  This would save me many hours each month reformatting lame formatted .NET code written in VB6/classic ASP style.

  • How does the parser distinguish an auto-property declaration from a normal one? Does it look ahead for "Get" or "Set" token, and, if there isn't one, assumes an auto-property?

  • How do auto-property declarations work with interfaces?

  • Still no unsafe code blocks!!!

  • I guess upto now they still haven't invested in making the .net framework thread safe.

    Sigh...

  • Hi guys is it possible to assign values from one list object to another instide of doing like this "■Dim y As New List(Of String) From {"hello", "world"}" i want to assign the values which are return from database as a list consider "objlist1" is the list returned from my storeprocedure In place "From {"hello","world"} " array Can i do like this " Dim y As New List(Of String) From objlist1" Is it possible.

  • If your database list implements IEnumerable then you can call the extension method "ToList()" on it

  • You mean to say that if return type of Database function is IList then i can take values in List from IList

    Like

    Dim y As New List(Of String) From objlist1.ToList()  will this extracts all the values to list y. is this right? if so please can u give me a example?

    Thank you

Page 1 of 1 (15 items)