Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on


Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this


  1. 1. Managed Languages in VS2010 Mike Taulty Developer & Platform Group Microsoft Ltd [email_address] (/
  2. 2. Format of the session 1 2 3
  3. 3. Before we get started... <ul><li>What’s been going on with Visual Basic and C# since 2002? </li></ul><ul><li>Future commitment (from PDC 2008) </li></ul><ul><ul><li>“ Co-Evolution” of these 2 languages </li></ul></ul><ul><ul><li>Major features to surface in both languages </li></ul></ul><ul><ul><ul><li>( small print – “not necessarily in the same way” ) </li></ul></ul></ul>2002 2005 2007 2009
  4. 4. Visual Basic 10 1
  5. 5. Visual Basic 10 Additions
  6. 6. C# 4.0 2
  7. 7. C# 4.0 Additions
  8. 8. Combined Additions 3
  9. 9. Dynamic Programming in VS 2008 <ul><li>Many places in .NET where we need to interact with “dynamic objects” </li></ul><ul><ul><li>Reflection over .NET types </li></ul></ul><ul><ul><li>IDispatch invocation of COM types </li></ul></ul><ul><ul><li>Integrating with from .NET DLR language types </li></ul></ul><ul><ul><li>Integrating with the HTML DOM in Silverlight </li></ul></ul><ul><li>Today </li></ul><ul><ul><li>Some of this work is done in languages </li></ul></ul><ul><ul><li>Some of it in APIs </li></ul></ul><ul><ul><li>No consistent way of dealing with these scenarios </li></ul></ul>
  10. 10. Dynamic Programming in VS 2008 ( taking Reflection as one example ) Compiler Generates reflection-based goo Compiler Does not generate anything 
  11. 11. Dynamic Programming in VS 2010 Generated Code Uses System.Dynamic Compiler Compiler Like object but with dynamic method resolution & dispatch Plain CLR Object? IDispatch COM object? Implementation of IDynamicObject? Run-time type?
  12. 12. Dynamic types in C# 4, VB 10
  13. 13. Variance with Generic Types <ul><li>Applies to generic interfaces and delegates </li></ul><ul><li>Using interfaces as an example; </li></ul>NB: Snippets compile but (intentionally) throw at runtime in VS2008 here Access through a “base interface” Access through a “derived interface”
  14. 14. Variance with Generic Types Concrete Examples NB: Snippets compile but (intentionally) throw at runtime in VS2008 here Strings are objects? Strings are objects? Safe if the caller cannot pass object references to the implementation Safe if the implementation cannot pass object references to the caller
  15. 15. Variance with Generic Types <ul><li>New syntax in C# 4 and VB 10 to indicate how a generic parameter is used by the interface </li></ul>
  16. 16. Variance in generic types
  17. 17. COM Interoperability in VS 2008 <ul><li>Usual scheme for working with COM types </li></ul>COM TLB or DLL Visual Studio or tlbimp.exe converts all contained types, interfaces, etc. Interop Assembly ProgId() CoClass() ... .NET Code Reference Interop assembly needs also deploying. Can be painful. Can be more painful for Primary Interop Assemblies (PIAs) Can be more painful for Office PIAs.
  18. 18. COM Interoperability in VS 2010 <ul><li>Revised scheme for working with COM types </li></ul>Compiler option to copy COM interop types used by code into output assembly Interop Assembly .NET Code Reference Type 3 Type 4 Type 1 Type 2 Type 1 Type 2 Type 3 Type 4 Resulting Assembly
  19. 19. COM Interoperability in C# 4 <ul><li>COM code is littered with VARIANT types </li></ul><ul><ul><li>especially code written in VB or targetting VB </li></ul></ul><ul><li>With Visual Studio < 2010 </li></ul><ul><ul><li>Generated interop code used object for VARIANT </li></ul></ul><ul><li>With Visual Studio 2010 </li></ul><ul><ul><li>Choose to embed interop code in assembly </li></ul></ul><ul><ul><li>Signatures are rewritten to use dynamic rather than object </li></ul></ul>
  20. 20. COM Interoperability
  21. 21. Format of the session 1 2 3
  22. 22. Visual F# <ul><li>Shipping for the first time in Visual Studio 2010 </li></ul><ul><li>Session at 14:00 on Thursday </li></ul><ul><ul><li>“ Taking efficiency one step further – F#” </li></ul></ul><ul><ul><li>Oliver Sturm </li></ul></ul>
  23. 23. References <ul><li>“C# Futures ” </li></ul><ul><li>“VB Futures” </li></ul><ul><li>“The Future of C#” </li></ul><ul><li>“Future Directions for Visual Basic” </li></ul>
  24. 24. © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.