Top Banner
Visual Studio 2010 and .NET Framework 4 Training Workshop
22

Whats New In C Sharp 4 And Vb 10

Nov 07, 2014

Download

Technology

KulveerSingh

C#4.0 and Vb.NET
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Whats New In C Sharp 4 And Vb 10

Visual Studio 2010and

.NET Framework 4

Training Workshop

Visual Studio 2010and

.NET Framework 4

Training Workshop

Page 2: Whats New In C Sharp 4 And Vb 10

What’s New InC# 4.0 and Visual Basic

10

What’s New InC# 4.0 and Visual Basic

10NameTitleOrganizationEmail

Page 3: Whats New In C Sharp 4 And Vb 10

Where We’re At TodayWhere We’re At Today

Our managed languages are starting to share some very similar features:

Functional

Concise

Declarative

Page 4: Whats New In C Sharp 4 And Vb 10

Before

IList<Person> FindParentsWithChildNamed(string childName)

{var matches = new List<Person>();

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

LINQ, The Power of Declarative

Page 5: Whats New In C Sharp 4 And Vb 10

IList<Person> 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

LINQ, The Power of Declarative

Page 6: Whats New In C Sharp 4 And Vb 10

Why Declarative Matters…Why Declarative Matters…

Imperative Declarative

What

How

Page 7: Whats New In C Sharp 4 And Vb 10

Addressing Language TrendsAddressing Language Trends

Declarative

Concurrent

Dynamic

Page 8: Whats New In C Sharp 4 And Vb 10

The Evolution of C#The Evolution of C#

C# 1.0

C# 2.0

C# 3.0

Managed Code

Generics

LINQ

C# 4.0

Dynamic

Page 9: Whats New In C Sharp 4 And Vb 10

New C# 4.0 FeaturesNew C# 4.0 Features

1. Late-Binding Support

2. Named and Optional Parameters

3. Improved COM Interop

4. Covariance and Contravariance

Page 10: Whats New In C Sharp 4 And Vb 10

Simplifying Your Code with C# 4.0

Simplifying Your Code with C# 4.0

Page 11: Whats New In C Sharp 4 And Vb 10

Co-evolving C# and VBCo-evolving C# and VB

Think of co-evolution as a game of leap-frog…

Page 12: Whats New In C Sharp 4 And Vb 10

There’s a problem when co-evolution doesn’t

exist…

Page 13: Whats New In C Sharp 4 And Vb 10

The Evolution of Visual BasicThe Evolution of Visual Basic

VB1 – VB3

VB4-VB6

VB7-VB9

Windows ProgrammingMade Easy

ComponentsMade Easy

Power andSimplicity for

.NET

VB10

Continuing the trend

Page 14: Whats New In C Sharp 4 And Vb 10

New VB10 FeaturesNew VB10 Features

1. Auto-Implemented Properties

2. Collection Initializers

3. Statement Lambdas

4. Covariance and Contravariance

5. Implicit Line Continuation

Page 15: Whats New In C Sharp 4 And Vb 10

VB 10VB 10

Page 16: Whats New In C Sharp 4 And Vb 10

Why a “Dynamic Language Runtime”?Why a “Dynamic Language Runtime”?

Common Language Runtime

Statically-Typed

C#VB

RubyPython

Dynamically-Typed

Page 17: Whats New In C Sharp 4 And Vb 10

Why a “Dynamic Language Runtime”?Why a “Dynamic Language Runtime”?

Common Language Runtime

Statically-Typed

C#VB

RubyPython

Dynamically-Typed

Dynamic Language Runtime

Page 18: Whats New In C Sharp 4 And Vb 10

PythonBinder

RubyBinder

COMBinder

JScriptBinder

ObjectBinder

.NET Dynamic Programming.NET Dynamic Programming

Dynamic Language Runtime

Expression TreesDynamic Dispatch

Call Site Caching

IronPython

IronRuby C# VB.NET Others…

Page 19: Whats New In C Sharp 4 And Vb 10

Dynamically Typed ObjectsDynamically 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

Page 20: Whats New In C Sharp 4 And Vb 10

Dynamic Language InteropDynamic Language Interop

Page 21: Whats New In C Sharp 4 And Vb 10

Summary…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

Page 22: Whats New In C Sharp 4 And Vb 10