presentatie .net 4/vs2010

Post on 29-Jun-2015

884 Views

Category:

Technology

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

Introduction presentation for colleagues about what's new in the .NET 4 release

TRANSCRIPT

VS2010 & .NET 4.0Capgemini BAS / Capgemini Technology ServicesMicrosoft Professionals Meet & Greet 29 september 2009

Microsoft Meet & Greet / 29 september 2009

Agenda

Wat is nieuw in .NET 4.0?

C# 4.0

Dynamic keyword

Parallel Extensions

TDD Visual Studio 20102

Microsoft Meet & Greet / 29 september 2009

Wat is nieuw in 4.0?

3

WinForms

ASP.NET

WPF

.NET CLR

LINQ MEFParallel

Extensions

Languages

CoreDLR

Base Class

Library

Data Services

Workflow Foundation

Communication

Foundation

“Velocity”

Entity Framework

LINQ to SQL

ADO.NET

Microsoft Meet & Greet / 29 september 2009

Framework Verbeteringen: WF/WCF

WF en WCF werken beter samen om lang draaiende workflows te kunnen programmeren

WF is uitgebreid met System.Activities

Eenvoudiger delen eigenschappen zonder DependencyProperties

4

Microsoft Meet & Greet / 29 september 2009

Wat is nieuw in C# 4.0

5

Microsoft Meet & Greet / 29 september 2009

Optional parameters

Mogelijkheid om standaard waardes te implementeren in methodes

• public static void DefaultExample(string x, int i = 100){…}

DefaultExample(“test”);

6

Microsoft Meet & Greet / 29 september 2009

Named arguments

Mogelijkheid om de parameter volgorde te wijzigen bij het aanroepen van methodes

• public static void NamedExample(int x, string y, int j){…}

NamedExample(j:20, y:”Foo”, x:10);

7

Microsoft Meet & Greet / 29 september 2009

Generic Variance

Co-variance (specific to generic):

List<string> strings = new List<string>();

strings.Add( "hello" ); strings.Add( "goodbye" ); List<object> objects = new

List<object>(); objects.AddRange( strings );

Contra-variance (generic to specific)Action<Student> submitLetter = (Person p) => {     SendMailTo(p.HomeAddress); };

Deze voorbeelden werkten niet in C# 3.5

Maar doen het wel in 4.0!

8

Microsoft Meet & Greet / 29 september 2009

Dynamic objects

object obj = tdse.GetObject(tcmUri, EnumOpenMode.OpenModeView, null, XMLReadFilter.XMLReadAll );

string title = null;if (obj is Component){ Component component = (Component) obj; title = component.Title;}…else if (obj is Page){ Page page = (Page) obj; title = page.Title;

}Display(title);

dynamic tridionItem = tdse.GetObject(tcmUri, EnumOpenMode.OpenModeView);

string title = tridionItem.Title;

Display(title);

9

Microsoft Meet & Greet / 29 september 2009

Dynamic objects

Code wordt tijdens runtime geëvalueerd

Object moet gedeclareerd worden met dynamic keyword

Geen IntelliSense support

DynamicObject baseclass om dynamisch gedrag zelf te bepalen

dynamic is geen var!

10

Microsoft Meet & Greet / 29 september 2009

DynamicObjects

Demo

Microsoft Meet & Greet / 29 september 2009

Parallel Extensions

12

Microsoft Meet & Greet / 29 september 2009

Parallel Extensions

13

Parallel class • static (overloaded) methods• helper methods to create/work with Tasks• encapsulates common patterns

Microsoft Meet & Greet / 29 september 2009

Parallel Extensions

Simpele parallele for loop:

int steps = 10;Parallel.For(0, steps, (i) => { Console.WriteLine(i); });

14

Microsoft Meet & Greet / 29 september 2009

Parallel Extensions

Dit kan ook met PLINQ:

var q = from p in people.AsParallel()        where p.Name == queryInfo.Name && p.State == queryInfo.State && p.Year >= yearStart && p.Year <= yearEnd        orderby p.Year ascending        select p;

15

Microsoft Meet & Greet / 29 september 2009

Parallel Extensions

Demo

Microsoft Meet & Greet / 29 september 2009

Visual Studio 2010

17

Microsoft Meet & Greet / 29 september 2009

TDD met VS2010

18

Write Test

Fail

Pass

Code

Refactor

N

Y

N

Y

Re-test

•Technique based on test-first approach• Write test first• Write code to pass test

• Benefits• Keeps focus on functionality of code• Full code coverage• Cleaner code

Microsoft Meet & Greet / 29 september 2009

TDD met VS2010

Demo

Microsoft Meet & Greet / 29 september 2009

TFS2010

•Test Impact Analysis• Setup by creating a teambuild• Finds code impacted by changes• Two Views

• Impacted tests• Changed code

• Visual Studio Team System

20

Together. Free your energies

Microsoft Meet & Greet / 29 september 2009

Remarks• Info uit deze presentatie is gebaseerd op

Beta1 van .NET 4.0 en VS2010!

Together. Free your energies

Microsoft Meet & Greet / 29 september 2009

• Niels Vrolijk: niels.vrolijk@capgemini.com

• Klaas Depenbrock: klaas.depenbrock@capgemini.com

22

top related