环视.NET Framework.pptx
Visual Studio 2010 andVisual Studio 2010 and .NET Framework 4.NET Framework 4 NameName TitleTitle Microsoft CorporationMicrosoft Corporation A Look Back .NET 1.0.NET 1.1.NET 2.0 3.0 3.5 .NET 4 200220032008 CTP2005-08 CLR 1.0CLR 1.1CLR 2.0CLR 4 SP1 The .NET Framework Base Class Libraries The CLR JIT .AsParallel() Parallel Computing Parallel LINQ (PLINQ) Common Language Runtime Statically-Typed C# VB Ruby Python Dynamically-Typed Why the DLR? Common Language Runtime Statically-Typed C# VB Ruby Python Dynamically-Typed Dynamic Language Runtime Why the DLR? Python Binder Ruby Binder COM Binder JScript Binder Object Binder .NET Dynamic Programming Dynamic Language Runtime Expression TreesExpression TreesDynamic DispatchDynamic DispatchCall Site CachingCall Site Caching IronPythonIronRubyC#VB.NETOthers Dynamically Typed Objects Calculator calc = GetCalculator(); int sum = calc.Add(10, 20); object calc = GetCalculator(); Type calcType = calc.GetType(); object res = calcType.InvokeMember(“Add“, BindingFlags.InvokeMethod, null, new object 10, 20 ); int sum = Convert.ToInt32(res); ScriptObject calc = GetCalculator(); object res = calc.Invoke(“Add“, 10, 20); int sum = Convert.ToInt32(res); dynamic calc = GetCalculator(); int sum = calc.Add(10, 20); Statically typed to be dynamic Dynamic method invocation Dynamic conversion DLR Integration Type Equivalence Interop Assemblies translate between managed code and COM For each interface, struct, enum, delegate, and member, contains a managed equivalent with marshalling data However! Primary Interop Assemblies cause many pain points Go Away, PIA! 1. Compilers embed the portions of the interop assemblies that the add-ins actually use 2. Runtime ensures the embedded definitions of these types are considered equivalent CLR 4 Type Equivalence .NET Framework Compatibility .NET 4.0 is a highly compatible release .NET 4.0 does not autoroll forward You must add a configuration file with a specific switch to get 3.5 apps to run on 4.0 .NET Framework Compatibility Hang on if 4.0 is compatible, why not run 3.5 apps automatically on 4.0? The BEST thing is always to prefer running on the version of the framework you built against CLR 2 - Existing Side-By-Side Host Process (i.e. Outlook) .NET 2.0 2.0 add-in 3.0 3.5 3.0 add-in 3.5 add-in 1.1 add-in .NET 1.1 CLR 4 - In-Process Side-By-Side .NET 2.0 .NET 4.0 2.0 add-in 3.0 3.5 Host Process (i.e. Outlook) 3.0 add-in 3.5 add-in 4.0 add-in Visual Studio 2010 Training Kit Download at http:/tinyurl.com/vs2010trainingkit