Visual Studio 2010 and.NET Framework 4 Training Workshop
Presentation Outline (hidden slide): Technical Level: 300 Intended Audience: Developers & Architects Objectives (what do you want the audience to take away): Understand the new features and improvements to C# 4.0 Understand the new features and improvements to VB 10 Understand the ongoing relationship between C# and VB as they both evolve Presentation Outline: Where we’re at today LINQ/Declarative Language Trends C# (Evolution -> C# 4.0) Co-Evolution VB (Evolution -> VB 10) DLR
What’s New In C# 4.0 and Visual Basic 10 Name Title Organization
Where We’re At Today Our managed languages are starting to share some very similar features: Functional Concise Declarative
Before IList FindParentsWithChildNamed(string childName) { var matches = new List (); foreach(var person in _people) { foreach(var child in person.Children) { if (child.Name.Equals(childName)) { matches.Add(person); break; } return matches; } LINQ, The Power of Declarative
IList FindParentsWithChildNamed(string childName) { var matches = from person in people from child in person.Children where child.Name.Equals(childName) select person; return matches.ToList(); } After LINQ, The Power of Declarative
Why Declarative Matters… ImperativeDeclarative What How
Addressing Language Trends Declarative ConcurrentDynamic
The Evolution of C# C# 1.0 C# 2.0 C# 3.0 Managed Code Generics LINQ C# 4.0 Dynamic
New C# 4.0 Features 1.Late-Binding Support 2.Named and Optional Parameters 3.Improved COM Interop 4.Covariance and Contravariance
Simplifying Your Code with C# 4.0
Co-evolving C# and VB Think of co-evolution as a game of leap-frog…
There’s a problem when co-evolution doesn’t exist…
The Evolution of Visual Basic VB1 – VB3 VB4-VB6 VB7-VB9 Windows Programming Made Easy Components Made Easy Power and Simplicity for.NET VB10 Continuing the trend
New VB10 Features 1.Auto-Implemented Properties 2.Collection Initializers 3.Statement Lambdas 4.Covariance and Contravariance 5.Implicit Line Continuation
VB 10
Why a “Dynamic Language Runtime”? Common Language Runtime Statically-Typed C# VB Ruby Python Dynamically-Typed
Why a “Dynamic Language Runtime”? Common Language Runtime Statically-Typed C# VB Ruby Python Dynamically-Typed Dynamic Language Runtime
Python Binder Ruby Binder COM Binder JScript Binder Object Binder.NET Dynamic Programming Dynamic Language Runtime Expression Trees Dynamic Dispatch Call Site Caching IronPython IronRuby C# VB.NET Others…
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
Dynamic Language Interop
Summary… 1.Targeting the current trends in programming languages 2.Addressing current pain points in developing for Windows and the.NET Framework 3.Laying the foundation to enable developers to solve tomorrow’s problems
What Is F#? F# Is… 1.A Functional Programming Language derived from OCaml and the ML family of languages 2.Included with Visual Studio Very good for compute-intensive problems, highly parallel problems, and language-oriented programming