Joel Pobar Language Geek Microsoft DEV320
Improve on C# % Backwards Compatible Language Integrated Query (LINQ)
C# 3.0C# 3.0 VB 9.0VB 9.0 OthersOthers.NET Language Integrated Query LINQ to Objects LINQ to DataSets LINQ to SQL LINQ to Entities LINQ to XML Objects XML Relational
Project Select, Return Select, Return Filter Where, Distinct Test Any( ), All( ) Join Join On = Join On = Group Group By, Aggregate, Group By, Aggregate, Group Join On = Aggregate Group Join On = Aggregate Aggregate Count( ), Sum( ), Min( ), Max( ), Avg( ), Group( )… Partition Skip [ While ], Take [ While ] Skip [ While ], Take [ While ] Set Union, Intersect, Except Order Order By, Order By,
Local Variable Type Inference Object Initializers Collection Initializers Anonymous Types Auto-Implemented Properties Extension Methods Lambdas Query Expressions Expression Trees Partial Methods Implicitly-Typed Arrays
Motivation Language Integrated Query C# 3.0 New Language Features
Technical Communities, Webcasts, Blogs, Chats & User Groups Microsoft Developer Network (MSDN) & TechNet Trial Software and Virtual Labs Microsoft Learning and Certification Visual C# Developer Center Visual Studio 2008 Beta1 Download Page Visual Studio 2008 Samples
© 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.
BinaryExpression ConstantExpression FuncletExpression InvocationExpression LambdaExpression MemberExpression MethodCallExpression NAryExpression NewArrayExpression NewExpression ParameterExpression TernaryExpression TypeBinaryExpression UnaryExpression
Expression: “a + b” ParameterExpression a = Expression.Parameter(typeof(int), "a"); ParameterExpression b = Expression.Parameter(typeof(int), "b"); BinaryExpression add = Expression.Add(a, b); Expression > l = Expression.Lambda >(add, a, b); Console.WriteLine(DoBinOp(l, 1, 2));
Param“a”Param“a” Param“b”Param“b” Binary “Add”