LINQ in Visual Studio 2008 Mike Taulty Developer

  • Slides: 12
Download presentation
LINQ in Visual Studio 2008 Mike Taulty Developer & Platform Group Microsoft Ltd Mike.

LINQ in Visual Studio 2008 Mike Taulty Developer & Platform Group Microsoft Ltd Mike. Taulty@microsoft. com http: //mtaulty. com

Why Have LINQ? Lots of code written today in order to loop, filter, sort,

Why Have LINQ? Lots of code written today in order to loop, filter, sort, group, etc. sort loop Why not build better support for this? sum

Why Have LINQ? Access to common data like XML or SQL is harder than

Why Have LINQ? Access to common data like XML or SQL is harder than accessing in memory objects; hope! pray! hope! Why not have better API’s than this?

Language Integrated Query from join on let where orderby select group into data in

Language Integrated Query from join on let where orderby select group into data in some. Data. Source other. Data in some. Other. Source key. Expr equals key. Expr (into item. Name)? some. Variable = some. Expression some. Predicate (expression (ascending | descending)? )* expression Language Features ( C# V 3 and VB V 9 ) expression by key. Expression item. Name. NET Framework V 3. 5 Custom Objects XML SQL

{ a little linq to objects } demo

{ a little linq to objects } demo

How Does LINQ Work? Compiler rewrites as method calls No need to implement Select()

How Does LINQ Work? Compiler rewrites as method calls No need to implement Select() etc. if my. Data is either IEnumerable IQueryable Implementations already present in the. NET Framework for those cases

IEnumerable & IQueryable? IEnumerable – query executed serially, one operator at a time where

IEnumerable & IQueryable? IEnumerable – query executed serially, one operator at a time where select Execute IQueryable – whole query passed to implementation for execution where select Capture & Execute

{ queryable, enumerable } demo

{ queryable, enumerable } demo

LINQ in. NET Framework V 3. 5 XML SQL Objects Data. Set LINQ

LINQ in. NET Framework V 3. 5 XML SQL Objects Data. Set LINQ

{ linq to xml, linq to sql } demo

{ linq to xml, linq to sql } demo

Resources http: //msdn. microsoft. com/linq

Resources http: //msdn. microsoft. com/linq

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows Vista and other product names

© 2007 Microsoft Corporation. All rights reserved. Microsoft, 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.