Visual Studio 2010 and.NET Framework 4 Training Workshop.

Slides:



Advertisements
Similar presentations
The Microsoft Technical Roadshow 2007 Language Enhancements and LINQ Daniel Moth Developer & Platform Group Microsoft Ltd
Advertisements

Dynamic internals. Introductions  Alexandru Ghiondea  C# Compiler QA  
Visual Studio 2010 and.NET Framework 4 Bernard Fedotoff
 Anders Hejlsberg Technical Fellow Microsoft Corporation TL16.
What's new in Microsoft Visual C Preview
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 12 th -13 th Lecture Pavel Ježek.
Copyright © 2012 Pearson Education, Inc. Chapter 9 Delegates and Events.
Ken Casada Developer Evangelist Microsoft Switzerland
.NET 3.5 – Mysteries. NetFx Evolution NetFx 1.0 C# 1.0, VB 7.0, VS.NET NetFx 1.1 C# 1.1, VB 7.1, VS 2003 NetFx 2.0 C# 2.0, VB 8.0, VS 2005 NetFx 3.0 C#
Lisa Feigenbaum Community Program Manager Microsoft Corporation SESSION CODE: DEV04-INT.
Generic programming in Java
Introduction to the C# Programming Language for the VB Programmer.
What’s New in C# 4.0? Pavel Yosifovich SELA Group
Programming in Scala Chapter 1. Scala: both object-oriented and functional Scala blends –object-oriented and –functional programming in a –statically.
Gurinder CTO. Lisa Feigenbaum Microsoft Program Manager Visual Studio Languages
demo video demo Dynamic Languages Simple and succinctImplicitly typedMeta-programmingNo compilation Static Languages RobustPerformantIntelligent.
Louis de Klerk Consultant Inobits Consulting DTL308.
Programming Languages and Paradigms Object-Oriented Programming.
A TOUR OF RUBY 2011 ACM Class, Dong Xie. What is Ruby?  Dynamic programming language  Complex but expressive grammar  A core class library with rich.
Eric Vogel Software Developer A.J. Boggs & Company.
Visual Studio 2010 and.NET Framework 4 Training Workshop.
Static and Dynamic Behavior CMPS Power of OOP Derives from the ability of objects to change their behavior dynamically at run time. Static – refers.
Dynamic Languages & The.Net Framework Shay Friedman ActionBase
Alex Turner C# Compiler PM Session Code: DEV402 On the Dynamic menu today… The Dynamic Language Runtime How does it relate to the CLR? Dynamic in C#
 Jim Hugunin Partner Architect Microsoft Corporation TL10.
Calculator calc = GetCalculator(); int sum = calc.Add(10, 20); Calculator calc = GetCalculator(); int sum = calc.Add(10, 20); object calc.
© FPT Software Advanced features in C# 1. © FPT Software Agenda Attributes Delegates & Events Anonymous Types & Dynamic Type Extension Methods Lambda.
Visual Studio 2010 and.NET Framework 4 Training Workshop.
Hoang Anh Viet Hà Nội University of Technology Chapter 1. Introduction to C# Programming.
Visual Studio 2010 and.NET Framework 4 Training Workshop.
Visual Studio 2010 and.NET Framework 4 Training Workshop.
C# 2.0 and Future Directions Anders Hejlsberg Technical Fellow Microsoft Corporation.
Python Functions.
Lisa Feigenbaum Microsoft Program Manager Session Code: DEV314.
Types in programming languages1 What are types, and why do we need them?
Lambda Expressions Version 1.0
Defining Classes I Part A. Class definitions OOP is the dominant programming methodology in use today. OOP is the dominant programming methodology in.
Ahmed Salijee Developer Advisor
Static. 2 Objectives Introduce static keyword –examine syntax –describe common uses.
IronRuby for the.NET Developer Cory Foy - Cory Foy, LLC + + =
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming I 10 th Lecture Pavel Ježek
CSCI 3327 Visual Basic Chapter 8: Introduction to LINQ and Collections UTPA – Fall 2011.
Satisfy Your Technical Curiosity C# 3.0 Raj Pai Group Program Manager Microsoft Corporation
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
Scott Hanselman Principal Program Manager Microsoft DTL303.
DEV394.NET Framework: Migrating To Managed Code Adam Nathan QA Lead Richard Lander Program Manager Microsoft Corporation.
IAP C# 2011 Lecture 2: Delegates, Lambdas, LINQ Geza Kovacs.
Jonathan Aneja Program Manager Microsoft Corporation Session Code: DTL336 Anders Hejlsberg Technical Fellow Microsoft Corporation.
Methods.
Session 02 Module 3: Statements and Operators Module 4: Programming constructs Module 5: Arrays.
Lap Around the.NET Framework 4 NameTitleCompany. A Look Back….NET 1.0.NET 1.1.NET NET CTP CLR 1.0 CLR 1.1 CLR 2.0 CLR.
Object-Oriented Programming: Classes and Objects Chapter 1 1.
Luke Hoban Senior Program Manager Microsoft Session Code: DTL310.
© Copyright SELA software & Education Labs Ltd Baruch Hirsch St.Bnei Brak Israel 1 בס " ד.
Lucian Wischik SESSION CODE: DEV401. Advanced Use of the New Microsoft Visual Basic 2010 Language Features Lucian Wischik, VB spec lead.
Visual Studio 2010 and.NET Framework 4 Training Workshop.
Heath Carroll Bill Hanczaryk Rich Porter.  A Theory of Type Polymorphism in Programming ◦ Robin Milner (1977)  Milner credited with introducing the.
Visual Studio 2010 and .NET Framework 4 Name Title
/* LIFE RUNS ON CODE*/ Konstantinos Pantos Microsoft MVP ASP.NET
MIS Professor Sandvig MIS 324 Professor Sandvig
Creating Your OwnClasses
C# in the Big World Mads Torgersen Program Manager
Visual Studio 2010 and .NET Framework 4 Training Workshop
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
Methods Additional Topics
.NET and .NET Core 9. Towards Higher Order Pan Wuming 2017.
Tech·Ed North America /18/2018 5:14 PM
Paul Stubbs MCSD, MCSE 4.0, MCP+I, MCT, MCAD .Net
Presentation transcript:

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

Essence versus Ceremony Simple, Concise, Expressive

Ceremony in C# 3.0 Removing “magic values” via temporary variables GenerateChart(20, true); var processCount = 20; var copyToWord = true; GenerateChart(processCount, copyToWord);

Ceremony in C# 3.0 Removing “magic values” via temporary variables GenerateChart(20, true); GenerateChart(20 /* processCount */, true /* copyToWord */);

Ceremony in C# 3.0 Optional parameters via method overloading void GenerateChart(int processCount) { GenerateChart(processCount, false); } void GenerateChart(int processCount, bool copyToWord) { // Do Something }

Ceremony in C# 3.0 Ugly COM Interop and the ever-present “ref Missing.Value” var word = new Word.Application(); word.Documents.Add(ref Missing.Value, ref Missing.Value, ref Missing.Value);

Essence vs. Ceremony in C# 4.0

Ceremony in VB 9 Backing fields for properties are explicit Private m_name As String Public Property Name() As String Get Name = m_name End Get Set (ByVal value As String) m_name = value End End Property

Ceremony in VB 9 Popularity of lambda-based libraries cause problems for VB developers Sub MyMethod() LambdaCall(Function(i) TempMethod(i) End Function) End Sub Function TempMethod(Dim param as Integer) As Nothing Console.WriteLine(param) Return Nothing End Function Introduction of temporary functions “Hacks” since statement lambdas not supported

Ceremony in VB 9 Line continuations must be specified by the developer SomeLongMethodCall(firstParam, _ secondParam, _ thirdParam, _ fourthParam, _ fifthParam)

Essence vs. Ceremony in 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

Ceremony in C# 3.0 Dynamic Language interop is painful Calculator calc = GetCalculator(); int sum = calc.Add(10, 20);

Ceremony in C# 3.0 Dynamic Language interop is painful object calc = GetCalculator(); Type calcType = calc.GetType(); object res = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, new object[] { 10, 20 }); int sum = Convert.ToInt32(res);

Ceremony in C# 3.0 Dynamic Language interop is painful ScriptObject calc = GetCalculator(); object res = calc.Invoke("Add", 10, 20); int sum = Convert.ToInt32(res);

Essence in C# 4.0 Dynamic Language interop doesn’t have to be painful! dynamic calc = GetCalculator(); int sum = calc.Add(10, 20); Statically typed to be dynamic Dynamic method invocation Dynamic conversion

The power of late-binding

New Features in C# 4.0 & VB 10 FeatureVB10C#4 Auto-implemented Properties Collection Initializers Statement Lambdas Implicit Line ContinuationN/A Named/Optional Parameters Latebinding support (dynamic) Omit ref on COM calls New in Dev10 Already exists in VB9/C#3

New Features in C# 4.0 & VB 10 FeatureVB10C#4 Auto-implemented Properties Collection Initializers Statement Lambdas Implicit Line ContinuationN/A Named/Optional Parameters Latebinding support (dynamic) Omit ref on COM calls Interop with Dynamic Languages Co/contravariance PIA deployment not needed New in Dev10 Already exists in VB9/C#3

New Features in C# 4.0 & VB 10 FeatureVB10C#4 Auto-implemented Properties Collection Initializers Statement Lambdas Implicit Line ContinuationN/A Named/Optional Parameters Latebinding support (dynamic) Omit ref on COM calls Interop with Dynamic Languages Co/contravariance PIA deployment not needed Iterators XML Literals New in Dev10 Already exists in VB9/C#3

Fixing The Type System… Covariance and Contravariance… sounds complicated… But it’s not! sort of…

Fixing The Type System… How are generic types “broken” today? var sheep = new List (); Speak(sheep); void Speak(IEnumerable animals) { // Do something with Animals } class Animal { } class Sheep : Animal { } Not Allowed: IEnumerable != IEnumerable Not Allowed: IEnumerable != IEnumerable

Break it down… Covariance – think “out” Contravariance – think “in”

Generic Variance Fixing the Type System

Fixing The Type System… Covariance and Contravariance Sounds complicated!

Essence versus Ceremony