SlideShare uma empresa Scribd logo
1 de 45
Grégory Renard CTO – R&I Manager Wygwam Microsoft Regional Director / Microsoft MVP gregory@wygwam.com LINQ{Des nouveautés de 				C#3/VB9 à LINQ}
A propos … de votre speaker : Gregory Renard [akaRedo] ,[object Object]
 Bureau d’étude et d’aide à l’acquisition des technologies
 Microsoft RegionalDirector / MVP
 Auteur (2001 – 2008)
 Livres/Livres Blancs : .NET 2.0 /3.0/3.5– C#/VB – VS2005/VS2008
 Articles/Dossiers Techniques presse francophone
 Communautaire
 Blog : http://blogs.developpeur.org/redo
 Sites : Codes-Sources, ASP-PHP.NET, TechHeadBrothers, MSDN, …
 Speaker Microsoft .NET > 6 ans
 Events MSDN Belgique – Luxembourg
 Events MSDN France
TechDays France, BeLux, Suisse
Wygday
 E-mail : gregory@wygwam.com,[object Object]
Rappel Avant LINQ … évolutions du .NETFx, des langages et de son IDE
De 2002 à 2008 Source : http://www.danielmoth.com/Blog/2007/06/visual-studio-2008-stack.html
De 2002 à 2008
.NET Framework 3.5 SP1 ADO.NET Entity Framework ADO.NET Data  Services ASP.NET Dynamic Data WPF & WCF Enhancements .NET Framework 3.5 Framework LINQ WCFFEnhancements Additional Enhancements .NET Framework 3.0 + SP2 WPF WCF WF Windows CardSpace .NET Framework 2.0 + SP2
Qu’est-ce qui est cool dans .NET 3.5?? Linq Linq to objects Linq to xml Linq to Sql Linq to dataset LinqLinqDataSource in ASP.NET Linq support in WPF databinding Linq Linq, Linq, …
Qu’est-ce qui est cool dans .NET 3.5?? Web applications ASP.NET AJAX built in Application Services Exposed ListView control Service Applications Syndication object model WCF support for REST and JSON services WCF & WF integration Client Application Excellent tooling support! UIElement3D  Managed Add-in framework (System.AddIn) XBAP support for Firefox
Vue d’ensemble des évolutions de C# 3.0 / VB 9.0 Nouveautés des langages
C#, son Historique !
C# 3.0, ses objectifs de conception ! Intégration d’objets, des données relationnelles et du XML LINQ Enrichissement du langage (C# v1.0, v2.0) Basésur la .NET CLR 2.0	 Ajout de nouvellesfonctionnalités Lambda expressions Détachement du langage des APIs spécifiques 100% compatible avec les versions précédentes C# 3.0 peutêtrecomplètementtraduit en C# 2.0
C# 3.0, ses Innovations ! Query expressions var contacts =     from c in customers     where c.State == "WA"     select new { c.Name, c.Phone }; Expression trees Local variable type inference Automatic properties Lambda expressions var contacts =     customers     .Where(c => c.State == "WA")     .Select(c => new { c.Name, c.Phone }); Partial methods Extension methods Object initializers Anonymous types
VB, son Historique !
De C# 3.0 / VB 9.0 à LINQ … en route vers LINQ !!! ,[object Object]
 Le pourquoi des nouveautés
 C# v3.0 (VB v9.0)
 Des nouveautés à LINQ … 1 pas ?,[object Object]
Rappel C#2.0 / VB 8.0 Types Génériques (C#/VB) Classes partielles (C#/VB) Méthodes Anonymes (C#) Itérateurs (C#) Qualificateur global de Namespace (C#) Classes Statiques (C#) Types Nullables (C#) …
Nouveautés : C# v3.0 /  VB 9.0 ? http://msdn2.microsoft.com/en-us/library/bb383815(VS.90).aspx
Types implicites / Inférence de types « Var » Déclaration de variable ou Array sans spécifier de type Déclaration fortement typée Doit être directement initialisée Variables locales uniquement
Initialisation d’objets simplifiée Déclaration avec unesyntaxesimplifiée. Initialisationd’objettypé Person p = new Person {Name = "Chris Smith", Age = 31};  Initialisationd’objet avec type anonyme var productInfos = from p in products 			select new {p.ProductName, p.UnitPrice}; 	foreach(var p in productInfos){...} Initialisation d’objet avec un type nullable : compile time error !
… Initialisation de collections simplifiée Uniquement pour les collection de classes implémentant “IEnumerable” List<int> digits = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; 		List<Test> list = new List<Test>  		{  			new Test{ num = 1, s = "Hello"},  			new Test{ num = 2, s = "World"},  			new Test{ num = 3, s = "From C#"}  		};
… Propriétés automatiques Déclaration avec unesyntaxesimplifiée. Attributs non permis (utiliseralors la méthoderégulière)
Types anonymes Types automatiquement générés à la compilationvar v = new { Amount = 108, Message = "Hello" }; Non disponible dans le code source Intellisence disponible Typiquementutilisédans la clause select des query expression Repose surl’initialisationd’objet et collections var query = fromprod in Products		select new { prod.Color, prod.Price}; foreach(var v in query) 	{ Console.WriteLine("Color={0}, Price={1}", v.Color, v.Price); 	}
Méthodes d’extension  Ajout “Virtuel” d’une méthode à un type Méthode Static : premier paramètre “this” Étend, ne modifie pas le type, override  Définition du scope par “using namespaces”
Expressions Lambda Ecriture inline de méthodes Lambda opérateur « => » (se dit « conduit à ») Simplifications d'écriture des entêtes d'une méthode anonyme delegate int D1(int i); 	D1 myDelegate1 = x => x + 1; 	int j = myDelegate1(5); //j = 6 Permet d’écrire une fonction dans une expression et de récupérer un pointeur vers la fonction Possibilité de récupérer un arbre d’expression
Expressions Lambda Exemplesd’expressions lambda x => x + 1			// Implicitly typed, expression body x => { return x + 1; }		// Implicitly typed, statement body (int x) => x + 1		// Explicitly typed, expression body (int x) => { return x + 1; }	// Explicitly typed, statement body (x, y) => x * y			// Multiple parameters () => Console.WriteLine()	// No parameters
Expressions Lambda Inférence de type dans une Lambda customers.Where(c => c.City == "London"); Opérateurs de vérification Func<int, bool> myFunc = x => x == 5;  		bool result = myFunc(4); // returns false of course 		int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; 	int oddNumbers = numbers.Count(n => n % 2 == 1); Ne pas confondre avec l’opérateur  “>=“ var firstSmallNumbers = numbers.TakeWhile((n, index) => n >= index);
Méthodes Partielles Les types partiels peuvent maintenant contenir des méthodes partielles 	partial class Customer {	   partial void OnCreated() {	       Console.WriteLine(“Welcome new customer”);	   }	}
Et là … « LINQ » ! Des nouveautés à LINQ (.NET Language-IntegratedQuery) : un pas ? http://msdn2.microsoft.com/fr-fr/netframework/aa904594.aspx

Mais conteúdo relacionado

Mais procurados

Formation C# - Cours 3 - Programmation objet
Formation C# - Cours 3 - Programmation objetFormation C# - Cours 3 - Programmation objet
Formation C# - Cours 3 - Programmation objetkemenaran
 
Quelques notions de méta-programmation en C++
Quelques notions de méta-programmation en C++Quelques notions de méta-programmation en C++
Quelques notions de méta-programmation en C++galinierf
 
Chap 6 : classes et interfaces
Chap 6 : classes et interfacesChap 6 : classes et interfaces
Chap 6 : classes et interfacesAziz Darouichi
 
C++ Metaprogramming : multidimensional typelist
C++ Metaprogramming : multidimensional typelistC++ Metaprogramming : multidimensional typelist
C++ Metaprogramming : multidimensional typelistVincent Agnus
 
Programmation fonctionnelle
Programmation fonctionnelleProgrammation fonctionnelle
Programmation fonctionnelleJean Detoeuf
 
C# 5 versus Java 8... Quand C++ 11 s'invite à la fête
C# 5 versus Java 8... Quand C++ 11 s'invite à la fêteC# 5 versus Java 8... Quand C++ 11 s'invite à la fête
C# 5 versus Java 8... Quand C++ 11 s'invite à la fêteFabrice JEAN-FRANCOIS
 
Cours de programmation en c
Cours de programmation en cCours de programmation en c
Cours de programmation en cbenouini rachid
 
Introduction à la metaprogrammation en C++
Introduction à la metaprogrammation en C++Introduction à la metaprogrammation en C++
Introduction à la metaprogrammation en C++galinierf
 
Formation C# - Cours 4
Formation C# - Cours 4Formation C# - Cours 4
Formation C# - Cours 4kemenaran
 
Cours structures des données (langage c)
Cours structures des données (langage c)Cours structures des données (langage c)
Cours structures des données (langage c)rezgui mohamed
 
C++11 en 12 exemples simples
C++11 en 12 exemples simplesC++11 en 12 exemples simples
C++11 en 12 exemples simplesPethrvs
 
Qualité logicielle
Qualité logicielleQualité logicielle
Qualité logiciellecyrilgandon
 
Les fondamentaux de langage C#
Les fondamentaux de langage C#Les fondamentaux de langage C#
Les fondamentaux de langage C#Youness Boukouchi
 
Les nouveautés de C++11 : Ecrire du C++ Moderne
Les nouveautés de C++11 : Ecrire du C++ ModerneLes nouveautés de C++11 : Ecrire du C++ Moderne
Les nouveautés de C++11 : Ecrire du C++ ModerneMicrosoft
 
Exercices en langage c
Exercices en langage cExercices en langage c
Exercices en langage cDaoua Lotfi
 
Cours langage c
Cours langage cCours langage c
Cours langage ccoursuniv
 
Langage C
Langage  CLangage  C
Langage Cjwilili
 

Mais procurados (20)

Theme 6
Theme 6Theme 6
Theme 6
 
Formation C# - Cours 3 - Programmation objet
Formation C# - Cours 3 - Programmation objetFormation C# - Cours 3 - Programmation objet
Formation C# - Cours 3 - Programmation objet
 
Quelques notions de méta-programmation en C++
Quelques notions de méta-programmation en C++Quelques notions de méta-programmation en C++
Quelques notions de méta-programmation en C++
 
Chap 6 : classes et interfaces
Chap 6 : classes et interfacesChap 6 : classes et interfaces
Chap 6 : classes et interfaces
 
C++ Metaprogramming : multidimensional typelist
C++ Metaprogramming : multidimensional typelistC++ Metaprogramming : multidimensional typelist
C++ Metaprogramming : multidimensional typelist
 
Programmation en C
Programmation en CProgrammation en C
Programmation en C
 
Programmation fonctionnelle
Programmation fonctionnelleProgrammation fonctionnelle
Programmation fonctionnelle
 
C# 5 versus Java 8... Quand C++ 11 s'invite à la fête
C# 5 versus Java 8... Quand C++ 11 s'invite à la fêteC# 5 versus Java 8... Quand C++ 11 s'invite à la fête
C# 5 versus Java 8... Quand C++ 11 s'invite à la fête
 
Cours de programmation en c
Cours de programmation en cCours de programmation en c
Cours de programmation en c
 
Introduction à la metaprogrammation en C++
Introduction à la metaprogrammation en C++Introduction à la metaprogrammation en C++
Introduction à la metaprogrammation en C++
 
Formation C# - Cours 4
Formation C# - Cours 4Formation C# - Cours 4
Formation C# - Cours 4
 
Cours structures des données (langage c)
Cours structures des données (langage c)Cours structures des données (langage c)
Cours structures des données (langage c)
 
C++11 en 12 exemples simples
C++11 en 12 exemples simplesC++11 en 12 exemples simples
C++11 en 12 exemples simples
 
Qualité logicielle
Qualité logicielleQualité logicielle
Qualité logicielle
 
Les fondamentaux de langage C#
Les fondamentaux de langage C#Les fondamentaux de langage C#
Les fondamentaux de langage C#
 
Les nouveautés de C++11 : Ecrire du C++ Moderne
Les nouveautés de C++11 : Ecrire du C++ ModerneLes nouveautés de C++11 : Ecrire du C++ Moderne
Les nouveautés de C++11 : Ecrire du C++ Moderne
 
Exercices en langage c
Exercices en langage cExercices en langage c
Exercices en langage c
 
Cours langage c
Cours langage cCours langage c
Cours langage c
 
Langage C
Langage  CLangage  C
Langage C
 
Le langage C
Le langage CLe langage C
Le langage C
 

Destaque

Enhancing Deep learning through Education / Training
Enhancing Deep learning through Education / TrainingEnhancing Deep learning through Education / Training
Enhancing Deep learning through Education / TrainingDr.Kumuda Gururao
 
Problémy ICT a zkušenosti z jiných oborů
Problémy ICT a zkušenosti z jiných oborůProblémy ICT a zkušenosti z jiných oborů
Problémy ICT a zkušenosti z jiných oborůJiří Napravnik
 
Importance of Clinical documentation for accurate ICD-10 coding - Medical Coding
Importance of Clinical documentation for accurate ICD-10 coding - Medical CodingImportance of Clinical documentation for accurate ICD-10 coding - Medical Coding
Importance of Clinical documentation for accurate ICD-10 coding - Medical CodingVocis
 
Communication in Tourism
Communication in TourismCommunication in Tourism
Communication in Tourismlorenzo cantoni
 
Composites à matrices metalliques
Composites à matrices metalliquesComposites à matrices metalliques
Composites à matrices metalliquesIsaac Durocher
 
Modeling of a digital protective relay in a RT Digital Simulator
Modeling of a digital protective relay in a RT Digital SimulatorModeling of a digital protective relay in a RT Digital Simulator
Modeling of a digital protective relay in a RT Digital Simulatormichaeljmack
 
Digital Marketing Trends & Innovations Research
Digital Marketing Trends & Innovations ResearchDigital Marketing Trends & Innovations Research
Digital Marketing Trends & Innovations ResearchCarmelon Digital Marketing
 
Three dimensional transformations
Three dimensional transformationsThree dimensional transformations
Three dimensional transformationsNareek
 
Artritis reumatoide inmuno
Artritis reumatoide   inmunoArtritis reumatoide   inmuno
Artritis reumatoide inmunoAndyjacque
 
Dickens carol libro inglés
Dickens carol libro inglésDickens carol libro inglés
Dickens carol libro ingléscarlaesther
 
שירות עצמי דיגיטלי - מחקר מגמות וחדשנות
שירות עצמי דיגיטלי - מחקר  מגמות וחדשנותשירות עצמי דיגיטלי - מחקר  מגמות וחדשנות
שירות עצמי דיגיטלי - מחקר מגמות וחדשנותCarmelon Digital Marketing
 
Art thérapie de groupe
Art thérapie de groupeArt thérapie de groupe
Art thérapie de groupeVeraHeller
 

Destaque (19)

Intercanvi 15 16
Intercanvi 15 16Intercanvi 15 16
Intercanvi 15 16
 
VYPB-proposal-eng-dec13
VYPB-proposal-eng-dec13VYPB-proposal-eng-dec13
VYPB-proposal-eng-dec13
 
MME_05_16_16
MME_05_16_16MME_05_16_16
MME_05_16_16
 
Social media 1
Social media 1Social media 1
Social media 1
 
Are Healthcare Providers Ready for the Transition to ICD-10?
Are Healthcare Providers Ready for the Transition to ICD-10?Are Healthcare Providers Ready for the Transition to ICD-10?
Are Healthcare Providers Ready for the Transition to ICD-10?
 
Enhancing Deep learning through Education / Training
Enhancing Deep learning through Education / TrainingEnhancing Deep learning through Education / Training
Enhancing Deep learning through Education / Training
 
Problémy ICT a zkušenosti z jiných oborů
Problémy ICT a zkušenosti z jiných oborůProblémy ICT a zkušenosti z jiných oborů
Problémy ICT a zkušenosti z jiných oborů
 
Business plan
Business planBusiness plan
Business plan
 
Importance of Clinical documentation for accurate ICD-10 coding - Medical Coding
Importance of Clinical documentation for accurate ICD-10 coding - Medical CodingImportance of Clinical documentation for accurate ICD-10 coding - Medical Coding
Importance of Clinical documentation for accurate ICD-10 coding - Medical Coding
 
Communication in Tourism
Communication in TourismCommunication in Tourism
Communication in Tourism
 
Composites à matrices metalliques
Composites à matrices metalliquesComposites à matrices metalliques
Composites à matrices metalliques
 
Modeling of a digital protective relay in a RT Digital Simulator
Modeling of a digital protective relay in a RT Digital SimulatorModeling of a digital protective relay in a RT Digital Simulator
Modeling of a digital protective relay in a RT Digital Simulator
 
Digital Marketing Trends & Innovations Research
Digital Marketing Trends & Innovations ResearchDigital Marketing Trends & Innovations Research
Digital Marketing Trends & Innovations Research
 
Three dimensional transformations
Three dimensional transformationsThree dimensional transformations
Three dimensional transformations
 
Mobile Trends & Innovations Research 2016
Mobile Trends & Innovations Research 2016Mobile Trends & Innovations Research 2016
Mobile Trends & Innovations Research 2016
 
Artritis reumatoide inmuno
Artritis reumatoide   inmunoArtritis reumatoide   inmuno
Artritis reumatoide inmuno
 
Dickens carol libro inglés
Dickens carol libro inglésDickens carol libro inglés
Dickens carol libro inglés
 
שירות עצמי דיגיטלי - מחקר מגמות וחדשנות
שירות עצמי דיגיטלי - מחקר  מגמות וחדשנותשירות עצמי דיגיטלי - מחקר  מגמות וחדשנות
שירות עצמי דיגיטלי - מחקר מגמות וחדשנות
 
Art thérapie de groupe
Art thérapie de groupeArt thérapie de groupe
Art thérapie de groupe
 

Semelhante a Linq Tech Days08 Lux

Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Gregory Renard
 
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Gregory Renard
 
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Gregory Renard
 
Asp Au Service Des Mv Ps
Asp Au Service Des Mv PsAsp Au Service Des Mv Ps
Asp Au Service Des Mv PsGregory Renard
 
Ma stack d'outils agiles, tout un programme !
Ma stack d'outils agiles, tout un programme !Ma stack d'outils agiles, tout un programme !
Ma stack d'outils agiles, tout un programme !Cédric Leblond
 
Linq et Entity framework
Linq et Entity frameworkLinq et Entity framework
Linq et Entity frameworkDNG Consulting
 
Paris Web 2015 - Atelier désendettement Javascript legacy
Paris Web 2015 - Atelier désendettement Javascript legacyParis Web 2015 - Atelier désendettement Javascript legacy
Paris Web 2015 - Atelier désendettement Javascript legacyFrançois Petitit
 
ASP.NET MVC, Web API & KnockoutJS
ASP.NET MVC, Web API & KnockoutJSASP.NET MVC, Web API & KnockoutJS
ASP.NET MVC, Web API & KnockoutJSRenaud Dumont
 
SPA avec Angular et SignalR (FR)
SPA avec Angular et SignalR (FR)SPA avec Angular et SignalR (FR)
SPA avec Angular et SignalR (FR)Rui Carvalho
 
ASP.NET MVC 6
ASP.NET MVC 6ASP.NET MVC 6
ASP.NET MVC 6Microsoft
 
Le Developpement Web Aspnet2 Vb2005
Le Developpement Web Aspnet2   Vb2005Le Developpement Web Aspnet2   Vb2005
Le Developpement Web Aspnet2 Vb2005Gregory Renard
 
Dea Presentation Pierre Marguerite 24 Juin 2003
Dea Presentation Pierre Marguerite 24 Juin 2003Dea Presentation Pierre Marguerite 24 Juin 2003
Dea Presentation Pierre Marguerite 24 Juin 2003Pierre Marguerite
 
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...ENSIBS
 
Keynote .NET 2015 : une nouvelle ère
Keynote .NET 2015 : une nouvelle èreKeynote .NET 2015 : une nouvelle ère
Keynote .NET 2015 : une nouvelle èreMicrosoft
 
Paul valery et les Web components
Paul valery et les Web componentsPaul valery et les Web components
Paul valery et les Web componentsFrancois ANDRE
 
Paris Web 2015 - Atelier desendettement javascript
Paris Web 2015 - Atelier desendettement javascriptParis Web 2015 - Atelier desendettement javascript
Paris Web 2015 - Atelier desendettement javascriptMichael Akbaraly
 
Bluetooth Low Energy dans les applications Windows
Bluetooth Low Energy dans les applications WindowsBluetooth Low Energy dans les applications Windows
Bluetooth Low Energy dans les applications WindowsMicrosoft
 

Semelhante a Linq Tech Days08 Lux (20)

Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
 
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
 
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
 
Asp Au Service Des Mv Ps
Asp Au Service Des Mv PsAsp Au Service Des Mv Ps
Asp Au Service Des Mv Ps
 
Ma stack d'outils agiles, tout un programme !
Ma stack d'outils agiles, tout un programme !Ma stack d'outils agiles, tout un programme !
Ma stack d'outils agiles, tout un programme !
 
Roslyn
RoslynRoslyn
Roslyn
 
Linq et Entity framework
Linq et Entity frameworkLinq et Entity framework
Linq et Entity framework
 
De Java à .NET
De Java à .NETDe Java à .NET
De Java à .NET
 
Paris Web 2015 - Atelier désendettement Javascript legacy
Paris Web 2015 - Atelier désendettement Javascript legacyParis Web 2015 - Atelier désendettement Javascript legacy
Paris Web 2015 - Atelier désendettement Javascript legacy
 
ASP.NET MVC, Web API & KnockoutJS
ASP.NET MVC, Web API & KnockoutJSASP.NET MVC, Web API & KnockoutJS
ASP.NET MVC, Web API & KnockoutJS
 
SPA avec Angular et SignalR (FR)
SPA avec Angular et SignalR (FR)SPA avec Angular et SignalR (FR)
SPA avec Angular et SignalR (FR)
 
ASP.NET MVC 6
ASP.NET MVC 6ASP.NET MVC 6
ASP.NET MVC 6
 
Le Developpement Web Aspnet2 Vb2005
Le Developpement Web Aspnet2   Vb2005Le Developpement Web Aspnet2   Vb2005
Le Developpement Web Aspnet2 Vb2005
 
Dea Presentation Pierre Marguerite 24 Juin 2003
Dea Presentation Pierre Marguerite 24 Juin 2003Dea Presentation Pierre Marguerite 24 Juin 2003
Dea Presentation Pierre Marguerite 24 Juin 2003
 
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...
Agile Tour Paris 2014 : Ma stack d'outils Agiles, tout un programme !, Cedric...
 
Keynote .NET 2015 : une nouvelle ère
Keynote .NET 2015 : une nouvelle èreKeynote .NET 2015 : une nouvelle ère
Keynote .NET 2015 : une nouvelle ère
 
Paul valery et les Web components
Paul valery et les Web componentsPaul valery et les Web components
Paul valery et les Web components
 
Paris Web 2015 - Atelier desendettement javascript
Paris Web 2015 - Atelier desendettement javascriptParis Web 2015 - Atelier desendettement javascript
Paris Web 2015 - Atelier desendettement javascript
 
Mongo db with C#
Mongo db with C#Mongo db with C#
Mongo db with C#
 
Bluetooth Low Energy dans les applications Windows
Bluetooth Low Energy dans les applications WindowsBluetooth Low Energy dans les applications Windows
Bluetooth Low Energy dans les applications Windows
 

Mais de Gregory Renard

WygDay - Session Innovation xBrainLab
WygDay - Session Innovation xBrainLabWygDay - Session Innovation xBrainLab
WygDay - Session Innovation xBrainLabGregory Renard
 
Approach the future of tourism by the new Technologies
Approach the future of tourism by the new TechnologiesApproach the future of tourism by the new Technologies
Approach the future of tourism by the new TechnologiesGregory Renard
 
Approach the future of cities by the singularity of technologies !
Approach the future of cities by the singularity of technologies !Approach the future of cities by the singularity of technologies !
Approach the future of cities by the singularity of technologies !Gregory Renard
 
Wygday 2009 Session Innovation
Wygday 2009   Session InnovationWygday 2009   Session Innovation
Wygday 2009 Session InnovationGregory Renard
 
Net 2007 Faire Du E Commerce Dans Les Mv
Net 2007   Faire Du E Commerce Dans Les MvNet 2007   Faire Du E Commerce Dans Les Mv
Net 2007 Faire Du E Commerce Dans Les MvGregory Renard
 
Wygday Session PléNièRe (2)
Wygday Session PléNièRe (2)Wygday Session PléNièRe (2)
Wygday Session PléNièRe (2)Gregory Renard
 
Wygday Session PléNièRe (1)
Wygday Session PléNièRe (1)Wygday Session PléNièRe (1)
Wygday Session PléNièRe (1)Gregory Renard
 
Vs2008 Breakthrough Software Dev
Vs2008 Breakthrough Software DevVs2008 Breakthrough Software Dev
Vs2008 Breakthrough Software DevGregory Renard
 
Visual Basic 9.0 Trucs Et Astuces Dans Visual Studio 2008
Visual Basic 9.0   Trucs Et Astuces Dans Visual Studio 2008Visual Basic 9.0   Trucs Et Astuces Dans Visual Studio 2008
Visual Basic 9.0 Trucs Et Astuces Dans Visual Studio 2008Gregory Renard
 
Visual Basic 9.0 Trucs Et Astuces Dans Visual Studio 2008
Visual Basic 9.0   Trucs Et Astuces Dans Visual Studio 2008Visual Basic 9.0   Trucs Et Astuces Dans Visual Studio 2008
Visual Basic 9.0 Trucs Et Astuces Dans Visual Studio 2008Gregory Renard
 
Techdays Visual Studio 2010
Techdays Visual Studio 2010Techdays Visual Studio 2010
Techdays Visual Studio 2010Gregory Renard
 
Ta Visual Studio2008 Vb9 C#3
Ta Visual Studio2008   Vb9   C#3Ta Visual Studio2008   Vb9   C#3
Ta Visual Studio2008 Vb9 C#3Gregory Renard
 
Principes De Base De Asp .Net
Principes De Base De Asp .NetPrincipes De Base De Asp .Net
Principes De Base De Asp .NetGregory Renard
 

Mais de Gregory Renard (20)

WygDay - Session Innovation xBrainLab
WygDay - Session Innovation xBrainLabWygDay - Session Innovation xBrainLab
WygDay - Session Innovation xBrainLab
 
WygDay 2010
WygDay 2010WygDay 2010
WygDay 2010
 
M Forum
M ForumM Forum
M Forum
 
Approach the future of tourism by the new Technologies
Approach the future of tourism by the new TechnologiesApproach the future of tourism by the new Technologies
Approach the future of tourism by the new Technologies
 
Approach the future of cities by the singularity of technologies !
Approach the future of cities by the singularity of technologies !Approach the future of cities by the singularity of technologies !
Approach the future of cities by the singularity of technologies !
 
Wygday 2009 Session Innovation
Wygday 2009   Session InnovationWygday 2009   Session Innovation
Wygday 2009 Session Innovation
 
Net 2007 Faire Du E Commerce Dans Les Mv
Net 2007   Faire Du E Commerce Dans Les MvNet 2007   Faire Du E Commerce Dans Les Mv
Net 2007 Faire Du E Commerce Dans Les Mv
 
Wygday Session PléNièRe (2)
Wygday Session PléNièRe (2)Wygday Session PléNièRe (2)
Wygday Session PléNièRe (2)
 
Wygday Session PléNièRe (1)
Wygday Session PléNièRe (1)Wygday Session PléNièRe (1)
Wygday Session PléNièRe (1)
 
Wygday 2008
Wygday 2008Wygday 2008
Wygday 2008
 
Web Services
Web ServicesWeb Services
Web Services
 
Vs2008 Breakthrough Software Dev
Vs2008 Breakthrough Software DevVs2008 Breakthrough Software Dev
Vs2008 Breakthrough Software Dev
 
Vs2008 Ms Lux
Vs2008 Ms LuxVs2008 Ms Lux
Vs2008 Ms Lux
 
Visual Basic 9.0 Trucs Et Astuces Dans Visual Studio 2008
Visual Basic 9.0   Trucs Et Astuces Dans Visual Studio 2008Visual Basic 9.0   Trucs Et Astuces Dans Visual Studio 2008
Visual Basic 9.0 Trucs Et Astuces Dans Visual Studio 2008
 
Visual Basic 9.0 Trucs Et Astuces Dans Visual Studio 2008
Visual Basic 9.0   Trucs Et Astuces Dans Visual Studio 2008Visual Basic 9.0   Trucs Et Astuces Dans Visual Studio 2008
Visual Basic 9.0 Trucs Et Astuces Dans Visual Studio 2008
 
Tour Horizont.Net
Tour Horizont.NetTour Horizont.Net
Tour Horizont.Net
 
Techdays Visual Studio 2010
Techdays Visual Studio 2010Techdays Visual Studio 2010
Techdays Visual Studio 2010
 
Ta Visual Studio2008 Vb9 C#3
Ta Visual Studio2008   Vb9   C#3Ta Visual Studio2008   Vb9   C#3
Ta Visual Studio2008 Vb9 C#3
 
Starter Kits
Starter KitsStarter Kits
Starter Kits
 
Principes De Base De Asp .Net
Principes De Base De Asp .NetPrincipes De Base De Asp .Net
Principes De Base De Asp .Net
 

Linq Tech Days08 Lux

  • 1.
  • 2. Grégory Renard CTO – R&I Manager Wygwam Microsoft Regional Director / Microsoft MVP gregory@wygwam.com LINQ{Des nouveautés de C#3/VB9 à LINQ}
  • 3.
  • 4. Bureau d’étude et d’aide à l’acquisition des technologies
  • 6. Auteur (2001 – 2008)
  • 7. Livres/Livres Blancs : .NET 2.0 /3.0/3.5– C#/VB – VS2005/VS2008
  • 8. Articles/Dossiers Techniques presse francophone
  • 10. Blog : http://blogs.developpeur.org/redo
  • 11. Sites : Codes-Sources, ASP-PHP.NET, TechHeadBrothers, MSDN, …
  • 12. Speaker Microsoft .NET > 6 ans
  • 13. Events MSDN Belgique – Luxembourg
  • 14. Events MSDN France
  • 17.
  • 18. Rappel Avant LINQ … évolutions du .NETFx, des langages et de son IDE
  • 19. De 2002 à 2008 Source : http://www.danielmoth.com/Blog/2007/06/visual-studio-2008-stack.html
  • 20. De 2002 à 2008
  • 21. .NET Framework 3.5 SP1 ADO.NET Entity Framework ADO.NET Data Services ASP.NET Dynamic Data WPF & WCF Enhancements .NET Framework 3.5 Framework LINQ WCFFEnhancements Additional Enhancements .NET Framework 3.0 + SP2 WPF WCF WF Windows CardSpace .NET Framework 2.0 + SP2
  • 22. Qu’est-ce qui est cool dans .NET 3.5?? Linq Linq to objects Linq to xml Linq to Sql Linq to dataset LinqLinqDataSource in ASP.NET Linq support in WPF databinding Linq Linq, Linq, …
  • 23. Qu’est-ce qui est cool dans .NET 3.5?? Web applications ASP.NET AJAX built in Application Services Exposed ListView control Service Applications Syndication object model WCF support for REST and JSON services WCF & WF integration Client Application Excellent tooling support! UIElement3D Managed Add-in framework (System.AddIn) XBAP support for Firefox
  • 24. Vue d’ensemble des évolutions de C# 3.0 / VB 9.0 Nouveautés des langages
  • 26. C# 3.0, ses objectifs de conception ! Intégration d’objets, des données relationnelles et du XML LINQ Enrichissement du langage (C# v1.0, v2.0) Basésur la .NET CLR 2.0 Ajout de nouvellesfonctionnalités Lambda expressions Détachement du langage des APIs spécifiques 100% compatible avec les versions précédentes C# 3.0 peutêtrecomplètementtraduit en C# 2.0
  • 27. C# 3.0, ses Innovations ! Query expressions var contacts = from c in customers where c.State == "WA" select new { c.Name, c.Phone }; Expression trees Local variable type inference Automatic properties Lambda expressions var contacts = customers .Where(c => c.State == "WA") .Select(c => new { c.Name, c.Phone }); Partial methods Extension methods Object initializers Anonymous types
  • 29.
  • 30. Le pourquoi des nouveautés
  • 31. C# v3.0 (VB v9.0)
  • 32.
  • 33. Rappel C#2.0 / VB 8.0 Types Génériques (C#/VB) Classes partielles (C#/VB) Méthodes Anonymes (C#) Itérateurs (C#) Qualificateur global de Namespace (C#) Classes Statiques (C#) Types Nullables (C#) …
  • 34. Nouveautés : C# v3.0 / VB 9.0 ? http://msdn2.microsoft.com/en-us/library/bb383815(VS.90).aspx
  • 35. Types implicites / Inférence de types « Var » Déclaration de variable ou Array sans spécifier de type Déclaration fortement typée Doit être directement initialisée Variables locales uniquement
  • 36. Initialisation d’objets simplifiée Déclaration avec unesyntaxesimplifiée. Initialisationd’objettypé Person p = new Person {Name = "Chris Smith", Age = 31}; Initialisationd’objet avec type anonyme var productInfos = from p in products select new {p.ProductName, p.UnitPrice}; foreach(var p in productInfos){...} Initialisation d’objet avec un type nullable : compile time error !
  • 37. … Initialisation de collections simplifiée Uniquement pour les collection de classes implémentant “IEnumerable” List<int> digits = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; List<Test> list = new List<Test> { new Test{ num = 1, s = "Hello"}, new Test{ num = 2, s = "World"}, new Test{ num = 3, s = "From C#"} };
  • 38. … Propriétés automatiques Déclaration avec unesyntaxesimplifiée. Attributs non permis (utiliseralors la méthoderégulière)
  • 39. Types anonymes Types automatiquement générés à la compilationvar v = new { Amount = 108, Message = "Hello" }; Non disponible dans le code source Intellisence disponible Typiquementutilisédans la clause select des query expression Repose surl’initialisationd’objet et collections var query = fromprod in Products select new { prod.Color, prod.Price}; foreach(var v in query) { Console.WriteLine("Color={0}, Price={1}", v.Color, v.Price); }
  • 40. Méthodes d’extension Ajout “Virtuel” d’une méthode à un type Méthode Static : premier paramètre “this” Étend, ne modifie pas le type, override Définition du scope par “using namespaces”
  • 41. Expressions Lambda Ecriture inline de méthodes Lambda opérateur « => » (se dit « conduit à ») Simplifications d'écriture des entêtes d'une méthode anonyme delegate int D1(int i); D1 myDelegate1 = x => x + 1; int j = myDelegate1(5); //j = 6 Permet d’écrire une fonction dans une expression et de récupérer un pointeur vers la fonction Possibilité de récupérer un arbre d’expression
  • 42. Expressions Lambda Exemplesd’expressions lambda x => x + 1 // Implicitly typed, expression body x => { return x + 1; } // Implicitly typed, statement body (int x) => x + 1 // Explicitly typed, expression body (int x) => { return x + 1; } // Explicitly typed, statement body (x, y) => x * y // Multiple parameters () => Console.WriteLine() // No parameters
  • 43. Expressions Lambda Inférence de type dans une Lambda customers.Where(c => c.City == "London"); Opérateurs de vérification Func<int, bool> myFunc = x => x == 5; bool result = myFunc(4); // returns false of course int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int oddNumbers = numbers.Count(n => n % 2 == 1); Ne pas confondre avec l’opérateur “>=“ var firstSmallNumbers = numbers.TakeWhile((n, index) => n >= index);
  • 44. Méthodes Partielles Les types partiels peuvent maintenant contenir des méthodes partielles partial class Customer { partial void OnCreated() { Console.WriteLine(“Welcome new customer”); } }
  • 45. Et là … « LINQ » ! Des nouveautés à LINQ (.NET Language-IntegratedQuery) : un pas ? http://msdn2.microsoft.com/fr-fr/netframework/aa904594.aspx
  • 46. LINQ : Définition Linq = LanguageINtegratedQuery Exemples DLinq = Database + Linq Appelé maintenant Linq to Data Xlinq = XML + Linq Appelé maintenant Linq to XML
  • 47. LINQ : Concepts Linq = innovation de VS2008 et .NET 3.5 Change radicalement le travail de données Avantages Simplifie l’écriture des requêtes Unifie la syntaxe de requêtes pour tout type de source de données Renforce la connection entre les données relationnelles et le monde de l’OO Accélère les développements Gestion des erreurs à la compilation Intellisense et debugging
  • 48. LINQ : Fondations C# v3.0 – VB v9.0 Query expressions var contacts = from c in customers where c.State == "WA" select new { c.Name, c.Phone }; Expression trees Local variable type inference Automatic properties Lambda expressions var contacts = customers .Where(c => c.State == "WA") .Select(c => new { c.Name, c.Phone }); Partial methods Extension methods Object initializers Anonymous types
  • 49. LINQ : Architecture Others… VB C# Sources de données LINQ .NET Language Integrated Query (LINQ) Linqsur des sources ADO.NET LINQ To XML LINQ To Entities LINQ To SQL LINQ To Datasets LINQ To Objects Provider <book> <title/> <author/> <price/> </book> XML Relationnel Objets
  • 50. Une syntaxe unique pour plusieurs sources de données
  • 51. LINQ : 3 parties de toute requête Touterequête LINQ consiste en 3 actions essentielles : Obtention de la source de données(xml, db, Objects) Création de la requête Exécution de la requête
  • 52. LINQ : Framework L’architecture à la base de Linq est constituée de deux parties LINQ Language Extensions Un langage de programmation implémentant les extensions de langage LINQ C# et VB implémentés au sein de VS2008 LINQ Providers Provider LINQ implémentant les Standard QueryOperator méthodes pour chaque source de données spéficique.
  • 53. LINQ : Requête de base IEnumerable<Customer> customerQuery = from cust in customers //... Exemple : List<int> numberList = new List<int> { 1, 2, 3, 4 }; var query = from i in numberList where i < 4 select i;
  • 54. Query Expressions Vs LINQ    var locals = from c in customers Wherec.ZipCode==91822 select (new {FullName=c.FirstName + “ “ + c.LastName, HomeAdresse=c.Address});  var locals = customers .Where(c => c.ZipCode == 91822) .Select(c => new { FullName = c.FirstName + “ “ + c.LastName, HomeAddress = c.Address });
  • 55. Linq or not : Différence ? C#2 List<City> returnCities = new List<City>(); Foreach (city c in cities) { If (c.Name==« London ») returnCities.Add(c); } C#3 / LINQ var query= from c in cities Where c. Name==« London » Select c;
  • 56. Exprimer la sémantique d’une requête Et non Son implémentation !
  • 57. LINQ : Projections - SELECT Utilisation du Keyword “Select” Nécessité de modifier, transformer les donnéesretournées par unerequête LINQ LINQ permet des scénariosavancés de mise en forme de données = “Projections” Exploitation des type anonymesproposés par le compilateur
  • 58. LINQ : Projections + Types Anonymes List<City> cities = CityUtilityHelper.GetCities(); var places = from city in cities where city.DistanceFromSeattle > 1000 select new { City = city.Name, Country = city.Country, DistInKm = city.DistFromSeattle * 1.61 }; GridView1.DataSource = places; GridView1.DataBind(); Type anonymeutilisé pour forger un type de retour personnalisé!Application d’une conversion Miles/Kms
  • 59. LINQ : Query Operators C# 3.0 VB 9.0 from .. in .. where .. select .. [into ..] group .. by .. [into ..] orderby .. [descending] join .. in .. on .. equals .. let .. = .. From .. [As ..] In .. Where .. Select .. [,..]* Group .. By .. Into .. Group Join .. [As ..] In .. On ..Equals .. [...] Into .. Order By ... [Descending] Join .. In .. On ..Equals .. [...] Let .. = ... Others: Skip, Skip While, Take, Take While Aggregates: All, Any, Average, [Long]Count, Max, Min, Sum Les opérateurs sont implémentés via des méthodes d’extensions
  • 61. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • 62. Firstname Lastname Title of the Presenter Goes Here Presentation title{with sample bracket usage}
  • 65. Firstname Lastname Title of the Presenter Goes Here Presentation title{with sample bracket usage}

Notas do Editor

  1. The main points are that the CLR engine is the same version (so no need to retest your apps) and that the headline feature is the language enhancements (C#3 & VB9 compilers) and LINQ.
  2. The main points are that the CLR engine is the same version (so no need to retest your apps) and that the headline feature is the language enhancements (C#3 & VB9 compilers) and LINQ.
  3. Time: 4 minDiscussion Points:How do the new 3.5 SP1 technologies relate to previous versions of the framework?First, let’s talk about how these new SP1 enhancements relate to the 3.5, 3.0, and 2.0 versions of the framework.The .NET Framework 3.5 SP1 will add these technologies on top of the framework 3.5 that just shipped in November.In addition, the current plan of record is that there will be updated service packs for both the 3.0 assemblies and the 2.0 framework and CLRSo to be clear, the .NET Framework 3.5 SP1 will depend on the .NET Framework 3.5, 3.0 with SP2, and 2.0 with SP2 to be installed on a users machine.
  4. C# - started as “the (first) language for CLR”; emphasize the pragmatic approach (cf. Anders Hejlsberg) = be explicit about language features like properties, events, etc.  developer confidence2.0 = generics wave (impact on CLR) + additional useful things (that do require generics on their own + that are useful on their own)3.0 = LINQ + making the language more concise, more productive, more powerful, ...
  5. LINQ: tell the story of Reflex 2.0, Dbase III+, ... where data and code were close together  structured + distributed programming changed this = layered approach  result: data and code on two islands with a huge gap between the two  need for O/R mapping tools etcWith LINQ: data becomes a first-class citizen of the languageReduce “language noise” (e.g. tiresome repetitive code etc)API independent  you can reimplement stuff on your own, the language doesn’t care about it (e.g. extension methods on Ienumerable<T>, don’t mention the word yet)Backward compat: refer to MSR paper on formal proof of the possibility for translation of every C# 3.0 program to an equivalent C# 2.0 program (semantically)
  6. Build up the slide and introduce “syntactical sugar”. Story telling approach referring back to the gap between data and code and the LINQ solution using Language Integrated queries  requires glue: functional style programming concepts, introduction of concepts from the relational world (e.g. projection clauses require anonymous types) and language simplification (e.g. object initializers).Use the words:-Different compilation stages (front-end query syntax is translated into “pure” C# into ..., e.g. resolution of query expressions to chains of method calls)-Method call chain (can still be instance methods or extension methods)
  7. VB = longer history (up to 9.0)Refer to huge transition from 6.0 to .NET which implied the creation of a runtime library for bw compat: play the rules of the CLS (OO for example) and remain consistent with VB pre-.NETVB 8.0 = GenericsVB 9.0 = LINQ + XML (difference with C#)
  8. http://msdn2.microsoft.com/fr-fr/library/7cz8t42e(VS.80).aspx
  9. http://msdn2.microsoft.com/en-us/library/bb383815(VS.90).aspx
  10. When used with local variables, the var keyword instructs the compiler to infer the type of the variable or the array elements from the expression on the right side of the initialization statement.Indispensable pour les types anonymeshttp://msdn2.microsoft.com/fr-fr/library/bb384061(VS.90).aspx
  11. http://msdn2.microsoft.com/fr-fr/library/bb384062(VS.90).aspx
  12. Collection initializers provide a way to specify one or more object intializers when initializing any collection class that implements IEnumerable. By using a collection initializer you do not have to specify multiple calls to the Add method of the class in your source code; the compiler adds the calls2ème exemple :The following collection initializer uses object initializers to initialize objects of the Test class defined in an earlier example. Note that the individual object initializers are enclosed in braces and separated by commas.