MTaulty_DevWeek_VS2010
-
Upload
ukdpe -
Category
Technology
-
view
319 -
download
0
Transcript of MTaulty_DevWeek_VS2010
![Page 1: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/1.jpg)
1
Managed Languages in VS2010
Mike TaultyDeveloper & Platform GroupMicrosoft [email protected] http://www.mtaulty.com (/DevWeek.zip)
![Page 2: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/2.jpg)
Format of the session
11
22
33
![Page 3: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/3.jpg)
Before we get started...
What’s been going on with Visual Basic and C# since 2002?
Future commitment (from PDC 2008)“Co-Evolution” of these 2 languagesMajor features to surface in both languages
( small print – “not necessarily in the same way” )
2002 2005 2007 2009
![Page 4: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/4.jpg)
Visual Basic 10
11
![Page 5: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/5.jpg)
5
Visual Basic 10 Additions
![Page 6: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/6.jpg)
C# 4.0
22
![Page 7: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/7.jpg)
7
C# 4.0 Additions
![Page 8: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/8.jpg)
Combined Additions
33
![Page 9: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/9.jpg)
Dynamic Programming in VS 2008
Many places in .NET where we need to interact with “dynamic objects”
Reflection over .NET typesIDispatch invocation of COM typesIntegrating with from .NET DLR language typesIntegrating with the HTML DOM in Silverlight
TodaySome of this work is done in languagesSome of it in APIsNo consistent way of dealing with these scenarios
![Page 10: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/10.jpg)
Dynamic Programming in VS 2008( taking Reflection as one example )
Compiler
Generates reflection-based goo
Compiler
Does not generate anything Does not generate anything
![Page 11: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/11.jpg)
Dynamic Programming in VS 2010
Generated CodeUses System.Dynamic
Compiler Compiler
Like object but with dynamic method resolution & dispatch
Plain CLR Plain CLR Object?Object?
IDispatchIDispatchCOM COM
object?object?Implementation of Implementation of IDynamicObject?IDynamicObject?
Run-Run-timetimetype?type?
![Page 12: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/12.jpg)
12
Dynamic types in C# 4, VB 10
![Page 13: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/13.jpg)
Variance with Generic Types
Applies to generic interfaces and delegatesUsing interfaces as an example;
Access through a “base Access through a “base interface”interface”
Access through a “derived Access through a “derived interface”interface”
NB: Snippets compile but (intentionally) throw at runtime in VS2008 here
![Page 14: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/14.jpg)
Strings are objects?Strings are objects?
Variance with Generic TypesConcrete 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
![Page 15: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/15.jpg)
Variance with Generic Types
New syntax in C# 4 and VB 10 to indicate how a generic parameter is used by the interface
![Page 16: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/16.jpg)
16
Variance in generic types
![Page 17: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/17.jpg)
COM Interoperability in VS 2008
Usual scheme for working with COM types
COM TLB or DLL
Visual Studio ortlbimp.exe convertsall contained types,interfaces, etc.
Interop Assembly
ProgId()CoClass()...
.NETCode
ReferenceInterop assembly needs also deploying.Can be painful.Can be more painful for Primary Interop Assemblies (PIAs)Can be more painful for Office PIAs.
![Page 18: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/18.jpg)
COM Interoperability in VS 2010
Revised scheme for working with COM types
Compiler option to copy COM interop typesused by code into output assemblyInterop
Assembly
.NETCode
Reference
Type 3Type 3Type 4Type 4
Type 1Type 1
Type 2Type 2
Type 1Type 1Type 2Type 2Type 3Type 3Type 4Type 4
ResultingAssembly
![Page 19: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/19.jpg)
COM Interoperability in C# 4
COM code is littered with VARIANT typesespecially code written in VB or targetting VB
With Visual Studio < 2010Generated interop code used object for VARIANT
With Visual Studio 2010Choose to embed interop code in assemblySignatures are rewritten to use dynamic rather than object
![Page 20: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/20.jpg)
20
COM Interoperability
![Page 21: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/21.jpg)
Format of the session
11
22
33
![Page 22: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/22.jpg)
Visual F#
Shipping for the first time in Visual Studio 2010
Session at 14:00 on Thursday“Taking efficiency one step further – F#”Oliver Sturm
![Page 23: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/23.jpg)
References
“C# Futures”“VB Futures”“The Future of C#” “Future Directions for Visual Basic”
![Page 24: MTaulty_DevWeek_VS2010](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a930821a28ab732a8b4570/html5/thumbnails/24.jpg)
© 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.