Slideshare.net (beta)

 
Post To TwitterPost to Twitter
Post: 
Myspace Hi5 Friendster Xanga LiveJournal Facebook Blogger Tagged Typepad Freewebs BlackPlanet gigya icons

All comments

Add a comment on Slide 1

If you have a SlideShare account, login to comment; else you can comment as a guest


Showing 1-50 of 2 (more)

Visual Studio 2008 Overview

From Redo, 10 months ago

1030 views  |  0 comments  |  2 favorites  |  50 downloads
 

Categories

Add Category
 
 

Groups / Events

 

 
Embed
options

More Info

This slideshow is Public
Total Views: 1030
on Slideshare: 1030
from embeds: 0

Slideshow transcript

Slide 1: No uve a u té s de l’IDE , C #3, VB 9 , … LINQ e t pe rs p e c tive s

Slide 2: … de votre s p e a ke r : G re g ory R e n a rd [a ka R e do ]

Slide 3: Vu e d ’e n s e m b le de s é vo lu tion s du .NE TF x e t de s on IDE

Slide 4: Vu e d ’e n s e m b le de s é vo lu tion s du .NE TF x e t de s on IDE

Slide 5: 2002 2003 2005 2006 2008 (? ) Vis ua l VS .NE T VS .NE T VS 2005 VS 2005 VS 2008 S tudio 2002 2003 + E xte ns ions La ng a g e C # v1.0 C # v1.1 C # v2.0 C # v2.0 C # v3.0 VB .NE T VB .NE T VB .NE T VB .NE T VB .NE T v7.0 v7.1 v8.0 v8.0 v9.0 F ra m e work .NE T 1.0 .NE T 1.1 .NE T 2.0 .NE T 3.0 .NE T 3.5 C LR C LR v1.0 C LR v1.1 C LR v2.0 C LR v2.0 C LR v2.0 S ourc e : h ttp:/ www.da nie lm oth .c om/ log / / B 2007/ vis ua l-s tudio-2008-s ta c k.h tml 06/

Slide 7: Vu e d ’e n s e m b le de s é vo lu tion s du .NE TF x e t de s on IDE

Slide 9:  Inté g ra tion d’ob je ts , de s donné e s re la tionne lle s e t du XML  LINQ  E nric h is s e m e nt du la ng a g e (C # v1.0, v2.0)  B a s é s ur la .NE T C LR 2.0  Ajout de nouve lle s fonc tionna lité s  La mbda e xpre s s ions  Dé ta c h e m e nt du la ng a g e de s AP Is s pé c ifiq ue s  100% c om pa tib le a ve c le s ve rs ions pré c é de nte s  C# 3.0 pe ut ê tre c om plè te me nt tra duit e n C# 2.0

Slide 10: Que ry va r c onta c ts = e xpre s s ions from c in c us tome rs wh e re c .S ta te == \"WA\" E xpre s s ion Loc a l va ria b le s e le c t ne w { c .Na me , c .P h one }; tre e s type infe re nc e Autom a tic La m b da prope rtie s e xpre s s ions va r c onta c ts = P a rtia l c us tome rs m e th ods .Wh e re (c => c .S ta te == \"WA\") .S e le c t(c => ne w { c .Na me , c .P h one }); E xte ns ion m e th ods Anonym ous Ob je c t type s initia liz e rs

Slide 12:  In té g ra tio n d’o b je ts , d e s d on n é e s re la tio n ne lle s e t d u XML  LINQ + Inté g ra tion XML  Am e liora tio n d u la n g a g e  Am é liora tio n de la s ynta xe de s tâ c h e s typiq ue s  Ajo u t de n o uve lle s fo nc tio nn a lité s  La m b da e xpre s s ions

Slide 13: Que ry Dim c onta c ts = e xpre s s ions F rom c In c us tome rs Wh e re c .S ta te = \"WA\" E xpre s s ion Im plic itly type d S e le c t Ne w With { Na me = c .Na me , _ tre e s loc a l va ria b le P h one = c .P h one } De e p XML La m b da s upport e xpre s s ions Dim c onta c ts = P a rtia l c us tome rs _ m e th ods .Wh e re (F unc tion(c ) c .S ta te = \"WA\") _ .S e le c t(F unc tion(c ) Ne w With { Na me = c .Na me , _ P h one = c .P h one }) E xte ns ion m e th ods Anonym ous Ob je c t type s initia liz e rs

Slide 14: Vu e d ’e n s e m b le de s é vo lu tion s du .NE TF x e t de s on IDE

Slide 15: h ttp:/ m s dn2.m ic ros oft.c om / n-us / ra ry/ z 8t42e (VS .80).a s px / e lib 7c

Slide 16:  S up p re s s io n d u b o xin g / b o xin g un  S uppre s s ion du C a s ting im plic ite  G e s tio n d e l’e rre ur lors d e la c o m p ila tio n  Me ille ure lis ib ilité d u c od e  Me ille ure s p e rfo rm a n c e s

Slide 17:  Dé fin itio n d’u n e c la s s e s ur p lus ie u rs fic h ie rs  Utilité d a n s la g é n é ra tio n d e c o de  E xplo ité p a r le s Winfo rm s e t We b fo rm s

Slide 18:  Ma n iè re d e p a s s e r u n b lo c d e c o de c o m m e p a ra m è tre de d é lé g u é .  R é du c tion d u c o d a g e d a n s l’in s ta nc ia tio n d e d é lé g u é s e n é lim ina n t la n é c e s s ité d e c ré e r u ne m é th o de s é pa ré e

Slide 19:  p u b lic de le g a te T F u nc <T, A> (A a )  Dé lé g ué g é né riq ue q ui re pré s e nte une fonc tion à un pa ra m è tre

Slide 20:  Mé th ode , a c c e s s e ur ou opé ra te ur g e t pe rm e tta nt de pre ndre e n c h a rg e l'ité ra tion fore a c h da ns une c la s s e ou une s truc t s a ns im plé m e nte r l'inte rfa c e IE num e ra b le d a ns s on inté g ra lité  E xé c ution diffé ré e  Mot c lé yie ld re turn

Slide 21:  «  :: »  R é s o u t le m e m b re ê tre c a c h é pa r un e a u tre e ntité d u m ê m e n o m .

Slide 22:  Ac c è s s a n s c ré a tio n d ’in s ta n c e s  C h a rg é a u to m a tiq u e m e n t p a r le C LR

Slide 23:  P e rm e t d ’a vo ir d e s typ e s va le urs n ulla b le s  P ra tiq u e p o ur le s d o n né e s nu lla b le s p rove n a n t d e b a s e s d e d on n é e s

Slide 24: h ttp:/ m s dn2.m ic ros oft.c om / n-us / ra ry/ b 383815(VS .90).a s px / e lib b

Slide 25:  «  Va r »  Dé c la ra tion de va ria b le ou Arra y s a ns s pé c ifie r de typ e  Dé c la ra tion forte m e nt typé e  Doit ê tre dire c te m e nt initia lis é e  Va ria b le s loc a le s u niq ue m e nt

Slide 26:  Dé c la ra tion a ve c une s ynta xe s implifié e .  Initia lis a tion d’ob je t typé Person p = new Person {Name = \"Chris Smith\", A = 31}; ge  Initia lis a tion d’ob je t a ve c type a nonyme var productInfos = from p in products select new {p.ProductName, p.U rice}; nitP foreach(var p in productI nfos){...}  Initia lis a tion d’ob je t a ve c un type nulla b le : c om pile tim e e rror !

Slide 27:  Un iq u e m e n t p o u r le s c o lle c tio n d e c la s s e s im p le m e n ta n t “Ie n u m e ra b le ” List<int> digits = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; L ist<Test> list = new List<Test> { new T num = 1, s = \"Hello\"}, est{ new T num = 2, s = \"World\"}, est{ new T num = 3, s = \"F C#\"} est{ rom };

Slide 28:  Dé c la ra tio n a ve c u n e s yn ta xe s im p lifié e .  Attrib uts n on p e rm is (u tilis e r a lo rs la m é th o de ré g u liè re )

Slide 29:  Type s a utom a tiq ue m e nt g é né ré s à la c om pila tion var v = new { Amount = 108, Message = \"Hello\" };  Non dis ponib le da ns le c ode s ourc e  Inte llis e nc e dis ponib le  Typiq ue m e nt utilis é da ns la c la us e s e le c t de s q ue ry e xpre s s ion  R e pos e s ur l’initia lis a tion d’ob je t e t c olle c tions var query = from prod in Products select new { prod.Color, prod.Price}; foreach(var v in query) { Console.WriteL ine(\"Color={0}, P rice={1}\", v.Color, v.Price); }

Slide 31:  E c riture inline de m é th ode s  La m b da opé ra te ur «  => »  S im plific a tions d'é c riture de s e ntê te s d'une m é th ode a nonym e delegate int D 1(int i); D myD 1 elegate1 = x => x + 1; int j = myD elegate1(5); //j = 6  P e rm e t d’é c rire une fonc tion da ns une e xpre s s ion e t de ré c upé re r un pointe ur ve rs la fonc tion  P os s ibilité de ré c upé re r un a rbre d’e xpre s s ion

Slide 32:  E xe m ple s d ’e xpre s s io ns la m b d a x => x + 1 / Im p lic itly type d, e xp re s s ion b od y / x => { re tu rn x + 1 ; } / Im p lic itly type d, s ta te m e nt b o dy / (int x) => x + 1 / E xp lic itly type d, e xp re s s ion b od y / (int x) => { re turn x + 1 ; } / E xp lic itly type d, s ta te m e nt b o dy / (x, y) => x * y / Mu ltiple pa ra m e te rs / () => C o ns o le .Write Lin e () / No p a ra m e te rs /

Slide 33:  In fé re n c e d e typ e da n s un e La m b d a customers.Where(c => c.City == \"London\");  Opé ra te urs de vé rific a tio n Func<int, bool> myF = x => x == 5; unc bool result = myFunc(4); // returns false of course int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int oddN umbers = numbers.Count(n => n % 2 == 1);  Ne p a s c o n fon d re a ve c l’o p é ra te u r “>=“ var firstSmallNumbers = numbers.TakeWhile((n, index) => n >= index);

Slide 34: using System.Linq.Expressions; Expression<Func<int, bool>> exprT = num => num < 5; ree  Le s e xpre s s io ns la m b da p e u ve n t ê tre tra d uite  C ode IL  Arb re d’e xpre s s ions ▪ P e uve nt ê tre pa rs é s a u R untim e ▪ Utilis é s a u s e in de s Linq Que ry P rovide r (Linq to S QL) Func<int,int> square = i => i * i; int four = square(2); Expression<Func<int,int>> squareEx = i => i * i; λ i * i i

Slide 35:  Un e e xp re s s io n re pré s e n te l’a rb re d ’ob je ts q u i re p ré s e n te l’e xp re s s io n p a s s é e e n a rg u m e n t

Slide 36:  Le s typ e s p a rtie ls p e u ve n t m a in te n a nt c o n te n ir d e s m é th o d e s p a rtie lle s partial class Customer { partial void OnCreated() { Console.WriteL ine(“Welcome new customer”); } }

Slide 37: h ttp:/ m s dn2.m ic ros oft.c om / n-us / ra ry/ / e lib y17w47a f(VS .90).a s px

Slide 38: Va lid for a ll va lue type s Dim a As Integer? ‘Will be Nothing a = 123 a = Nothing ‘Boolean HasValue property Dim hasValue = a.HasValue ‘Get the value via Value property or directly Dim value1 As Integer = a.Value Dim value2 As Integer = a Will th row e xc e ption if e q ua l to Noth ing

Slide 39:  «  Dim  »  Dé c la ra tio n d e va ria b le o u Arra y s a n s s p é c ifie r d e typ e  Dé c la ra tio n fo rte m e nt typé e  Do it ê tre d ire c te m e n t in itia lis é e  Va ria b le s loc a le s u n iq u e m e n t

Slide 40:  Dé c la ra tio n a ve c u n e s yn ta xe s im p lifié e  Mot c lé “With”  In itia lis a tion d ’ob je t typ é Dim namedCust = New Customer With {.Name = “xxx\"}  In itia lis a tion d ’ob je t a ve c typ e a n o n ym e Dim anonymousCust = New With {.Name = “xxx\"}  Initia lis a tion d’ob je t a ve c un type nulla b le : c ompile time e rror !

Slide 41:  Typ e s a u to m a tiq u e m e n t g é n é ré s à la c o m p ila tio n Dim product1 = New With {.Name = \"paperclips\", .P = 1.29} rice  No n d is po n ib le d a ns le c o d e s o u rc e  In te llis e n c e d is p o nib le  Typ iq u e m e nt u tilis é da n s la c la u s e s e le c t d e s q u e ry e xpre s s io n  R e po s e s u r l’in itia lis a tio n d ’o b je t

Slide 42:  C o m p a ra is on d e d e u x typ e s a n o n ym e s (Ke y)  Que le s «  Ke y » s ont c om pa ré e s  Le s va le urs de s «  Ke y » s ont : ▪ R e a d-Only ▪ Ne pe uve nt ê tre c h a ng é e s  S e ule la va le u r d'une pro prié té «  Ke y » e s t inc lus e da ns l'a lg orith m e c om pila te ur produ is a nt le c ode du typ e a non ym e .

Slide 43:  Vra ie re la xa tio n : le s p a ra m è tre s ne s o nt p a s e m plo yé s , vo us p o uve z n e p a s le s u tilis e r. Dim WithEvents btn As New Button() Sub B OnClick(ByVal sender As Object, ByVal e As EventArgs) Handles btn.Click MessageB ox.Show(\"Hello World from\" & btn.T ext) E Sub nd Sub RelaxedOnClick() Handles btn.Click MessageB ox.Show(\"Hello World from\" & btn.Text) E Sub nd

Slide 45:  E c ritu re in lin e d e m é th o de s Dim fnums = numbers.Where(Function(n) n < 5) La m b d a o p é ra te u r «  Func tio n »   S im p lific a tio n s d 'é c ritu re de s e n tê te s d 'u n e m é th o d e a n o nym e  P e rm e t d ’é c rire u n e fo n c tio n da n s un e e xp re s s ion e t d e ré c u p é re r un p o in te u r ve rs la fo n c tio n  P os s ib ilité de ré c upé re r u n a rb re d’e xpre s s ion

Slide 46:  Modè le h ié ra rc h iq ue d e prog ra m m a tion s im plifié Imports <xmlns:ns=“http://myNamespace/schema”> Dim books = <books> <book Title=“Welcome to VB 9.0”> <author Name=“Bart”> <origin>Belgium</origin> Inline XML </author> </book> C h ild a xis .< (for ite ra tion) </books> Attrib ute a xis (.@) For Each book in books.<book> Console.WriteLine(book.@Title); Console.WriteLine(book.<author>.@Name); Console.WriteLine(book...<origin>); De s c e nda nt a xis … Next s e a rc h in a ll de s c e nda nts

Slide 47: Dim countriesWithCapital = _ LINQ q ue ry <Countries> <%= From country In Countries, city In Capitals _ Where country.Name = city.Country _ Select _ <Country Name=<%= country.Name %> Density=<%= country.Population / country.Area %>> <Capital> <Name><%= city.Name %></Name> <Longitude><%= city.Longitude %></Longitude> <Latitude><%= city.Latitude %></Latitude> </Capital> </Country> _ AS P -a like e m b e dde d e xpre s s ions %> </Countries>

Slide 48:  F rie n d a s s e m b lie s  Inte rn a ls Vis ib le To a ttrib ute re c og niz e d  R u ntim e a g ility  C o m pile with out Mic ros oft.Vis ua lB a s ic .dll  Ne e d o rig ina te s from C F a nd S ilve rlig h t  Ne w / runtim e s witc h vb  Im p ro ve d g e n e ric typ e in fe re n c ing  C a llin g Ob je c t m e m b e rs o n in te rfa c e s

Slide 49: .NE T La n g u a g e -In te g ra te d Que ry h ttp:/ m s dn2.m ic ros oft.c om / / fr-fr/ tfra m e work/ a 904594.a s px ne a

Slide 50:  Linq = La n g u a g e INte g ra te d Qu e ry  E xe m p le s  DLinq = Da ta b a s e + Linq ▪ Appe lé ma inte na nt Linq to Da ta  Xlinq = XML + Linq ▪ Appe lé ma inte na nt Linq to XML

Slide 51:  Linq =  innova tion de VS 2008 e t .NE T 3.5  Ch a ng e ra dic a le me nt le tra va il de donné e s  Ava nta g e s  S implifie l’é c riture de s re quê te s  Unifie la s ynta xe de re quê te s pour tout type de s ourc e de donné e s  R e nforc e la c onne c tion e ntre le s donné e s re la tionne lle s e t le monde de l’OO  Ac c é lè re le s dé ve loppe me nts ▪ G e s tion d e s e rre urs à la c o m pila tio n ▪ Inte llis e ns e e t d e b ug g in g

Slide 52: Que ry va r c onta c ts = e xpre s s ions from c in c us tome rs wh e re c .S ta te == \"WA\" E xpre s s ion Loc a l va ria b le s e le c t ne w { c .Na me , c .P h one }; tre e s type infe re nc e Autom a tic La m b da prope rtie s e xpre s s ions va r c onta c ts = P a rtia l c us tome rs m e th ods .Wh e re (c => c .S ta te == \"WA\") .S e le c t(c => ne w { c .Na me , c .P h one }); E xte ns ion m e th ods Anonym ous Ob je c t type s initia liz e rs

Slide 53: Others… C# VB .NET Language Integrated Query (LINQ) Sources de données LINQ Linq sur des sources ADO.NET LINQ LINQ LINQ LINQ LINQ To XML To Datasets To Entities To SQL To Objects Provider <book> <title/> <author/> <price/> </book> Relationnel XML Objets

Slide 54: Une syntaxe unique pour plusieurs sources de données

Slide 55:  To ute re q u ê te LINQ c o n s is te e n a c tio n s e s s e n tie lle s :  Ob te ntion de la s ourc e de donné e s (xm l, db , Ob je c ts )  C ré a tio n d e la re q uê te  E xé c ution de la re q uê te

Slide 56:  L’a rc h ite c ture à la b a s e de Linq e s t c ons titué e de de ux pa rtie s  LIN Q Language Exte nsio ns Un la ng a g e de prog ra mm a tion implé me nta nt le s e xte ns ions de la ng a g e LINQ ▪ C# e t VB implé me nté s a u s e in de VS 2008  LIN Q Pro vide rs P rovide r LINQ im plé m e nta nt le s S ta nda rd Que ry Ope ra tor m é th ode s pour c h a que s ourc e de donné e s s pé fic ique .

Slide 57: I numerable<Customer> customerQuery = from E cust in customers //... Exemple : List<int> numberL = new L ist ist<int> { 1, 2, 3, 4 }; var query = from i in numberL ist where i < 4 select i;

Slide 58:    va r loc a ls = from c in c us tom e rs Wh e re c .ZipC ode ==91822 s e le c t (ne w {F ullNa m e = c .F irs tNa m e + “ “ + c .La s tNa m e , Hom e Adre s s e = c .Addre s s });  va r loc a ls = c us tom e rs .Wh e re (c => c .ZipC ode == 91822) .S e le c t(c => ne w { F ullNa m e = c .F irs tNa m e + “ “ + c .La s tNa m e , Hom e Addre s s = c .Addre s s });

Slide 59: C#2 C#3 Lis t<City> re turnCitie s = va r que ry= from c in c itie s ne w Lis t<City>(); Wh e re c . F ore a c h (c ity c in c itie s ) Na me ==«  London » { S e le c t c ; If (c .Na me ==«  London » ) re turnCitie s .Add(c ); }

Slide 60: Exprimer la sémantique d’une requête et non son implémentation

Slide 61: Utilis a tion du Ke ywo rd “Se le ct”   Né c e s s ité de m odifie r, tra ns form e r le s donné e s re tourné e s pa r une re q uê te LINQ  LINQ pe rm e t de s s c é na rios a va nc é s de m is e e n form e de donné e s = “P roje c tions ”  E xploita tio n de s type a nonym e s propo s é s pa r le c om pila te ur

Slide 62: List<City> cities = CityUtilityHelper.GetCities(); var places = from city in cities where city.DistanceFromSeattle > 1000 select new { City = city.Name, Country = city.Country, DistanceInKm = city.DistanceFromSeattle * 1.61 }; GridView1.DataSource = places; GridView1.DataBind(); Type anonyme utilisé pour forger un type de retour personnalisé ! Application d’une conversion Miles/Kms

Slide 63: VB 9.0 C# 3.0 Fro m .. [As ..] In .. fro m .. in ..   Whe re .. whe re ..   S e le c t .. [,..]*  s e le c t .. [into ..]  Gro up .. By .. Into ..  g ro up .. by .. [into ..]  Gro up Jo in .. [As ..] In .. On ..  o rde rby .. [de s c e nding ]  Equals .. [...] Into .. jo in .. in .. on .. e quals ..  Orde r By ... [De s c e nding ]  le t .. = ..  Jo in .. In .. On .. Equals .. [...]  Le t .. = ...  Le s o pé rate urs so nt implé me nté s  Oth e rs : via de s mé tho de s d’e xte nsio ns S kip, S kip Wh ile , Take , Ta ke Wh ile   Ag g re g ate s : All, Any, Ave ra g e , [Long ]C ount, Ma x, Min, S um

Slide 64: Vu e d ’e n s e m b le de s é vo lu tion s du .NE TF x e t de s on IDE

Slide 65: Que lq ue s e xe m ple s :  F ra me work Ta rg e ting (2.0, 3.0, 3.5)  Tous type s de proje ts “Out of th e box” !  Inté g ra tion de s de s ig ne rs WP F , WCF , WF  Inté g ra tion de VS TO  Inté g ra tion d’AS P .NE T AJ AX  Am é liora tion de l’é dite ur HTML ▪ S plit s ourc e / s ig n vie w de ▪ J a va S c ript Inte lliS e ns e e t de bug g ing ▪ CS S ma na g e r e t de bug g e r  Am é liora tions e s th é tique s e t d’us a g e

Slide 66:  R e m o te d e b u g g in g s u p po rt p o u r Wind o ws Vis ta  Am é liora tio n s u pp o rt d u de b u g g in g de s a p plic a tio n s m u ltith re a d  De b u g g ing s up p o rt p o u r LINQ  De b u g g ing s up p o rt fo r WC F  Me ille ur s up p o rt d e s s c ript d e d e b u g g in g

Slide 67: Vu e d ’e n s e m b le de s é vo lu tion s du .NE TF x e t de s on IDE