LINQ - 2 Ravi Kumar C++/C# Team.

Slides:



Advertisements
Similar presentations
Developer Knowledge Sharing Eric Sun Dec, What programming language did you learn in school and since then? Now, its time to refresh …
Advertisements

The Microsoft Technical Roadshow 2007 Language Enhancements and LINQ Daniel Moth Developer & Platform Group Microsoft Ltd
Deep Dive into LINQ Eran Sharabi.NET Development Team Leader JohnBryce Training
LINQ and Collections An introduction to LINQ and Collections.
Extension Methods, Anonymous Types LINQ Query Keywords, Lambda Expressions Svetlin Nakov Telerik Corporation
.NET 3.5 – Mysteries. NetFx Evolution NetFx 1.0 C# 1.0, VB 7.0, VS.NET NetFx 1.1 C# 1.1, VB 7.1, VS 2003 NetFx 2.0 C# 2.0, VB 8.0, VS 2005 NetFx 3.0 C#
C# and LINQ Yuan Yu Microsoft Research Silicon Valley.
LinqToSharePoint SandBoxed Solution Shakir Majeed Khan
LINQ: Language-Integrated Queries (To be included in C # 3.0) Technology developed by Anders Hejlsberg & friends at Microsoft (2005) Presented by Tal Cohen.
C# 3.0 Tom Roeder CS fa. Version 3 From PDC 2005 preview compiler available LINQ: language-integrated query High level points: adds native query.
2.3 Cool features in C# academy.zariba.com 1. Lecture Content 1.Extension Methods 2.Anonymous Types 3.Delegates 4.Action and Func 5.Events 6.Lambda Expressions.
C# 3.0 and LINQ Pavel Yosifovich CTO, Hi-Tech College
A tour of new features introducing LINQ. Agenda of LINQ Presentation We have features for every step of the way LINQ Fundamentals Anonymous Functions/Lambda.
XML files (with LINQ). Introduction to LINQ ( Language Integrated Query ) C#’s new LINQ capabilities allow you to write query expressions that retrieve.
LINQ Programming in C# LINQ CSE Prof. Roger Crawfis.
 Introduction  What is LINQ  Syntax  How to Query  Example Program.
Slides from Gang Luo, Xuting Zhao and Damien Guard
Extension Methods Programming in C# Extension Methods CSE Prof. Roger Crawfis.
LINQ, An IntroLINQ, An Intro Florin−Tudor Cristea, Microsoft Student Partner.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming I 11 th Lecture Pavel Ježek
Putting it all together: LINQ as an Example. The Problem: SQL in Code Programs often connect to database servers. Database servers only “speak” SQL. Programs.
Advanced C#, part IV Niels Hallenberg IT University of Copenhagen (With thanks to Peter Sestoft and Kasper Østerbye) BAAAP – Spring 2009.
Extension Methods, Anonymous Types LINQ Query Keywords, Lambda Expressions Based on material from Telerik Corporation.
Introduction to LINQ Lecture # 19 August Introduction How do you interrogate/manipulate data? What if you could do the work in a type-safe," string-free.
The.NET Language Integrated Query Project Anders Hejlsberg TLN306 Technical Fellow Microsoft Corporation.
Neal Stublen How does XMLReader work?  XmlReader.Read() Advances to next node XmlReader properties access node name, value, attributes,
 Language Integrated Query  Make query a part of the language  Component of.NET Framework 3.5  Shipped with Visual Studio 2008.
Hoang Anh Viet Hà Nội University of Technology Chapter 1. Introduction to C# Programming.
 Although VERY commonly used, arrays have limited capabilities  A List is similar to an array but provides additional functionality, such as dynamic.
Introduction to LINQ Chapter 11. Introduction Large amounts of data are often stored in a database—an organized collection of data. A database management.
C# 3.0 and LINQ Pavel Yosifovich CTO, Hi-Tech College
C#: Future Directions in Language Innovation Anders Hejlsberg TLN307 Technical Fellow Microsoft Corporation.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming I 10 th Lecture Pavel Ježek
CSCI 3327 Visual Basic Chapter 8: Introduction to LINQ and Collections UTPA – Fall 2011.
Inside LINQ to Objects How LINQ to Objects work Inside LINQ1.
QUERY PROCESSING RELATIONAL DATABASE KUSUMA AYU LAKSITOWENING
Satisfy Your Technical Curiosity C# 3.0 Raj Pai Group Program Manager Microsoft Corporation
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises 1 Xiang Lian The University of Texas – Pan American Edinburg,
IAP C# 2011 Lecture 2: Delegates, Lambdas, LINQ Geza Kovacs.
LINQ to DATABASE-2.  Creating the BooksDataContext  The code combines data from the three tables in the Books database and displays the relationships.
MIT-AITI: Functions Defining and Invoking Functions Functions as Data Function Scope: The call Object Function Arguments: The arguments objects Function.
LINQ Language Integrated Query LINQ1. LINQ: Why and what? Problem Many data sources: Relational databases, XML, in-memory data structures, objects, etc.
LINQ and Lambda Expressions Telerik Software Academy LINQ Overview.
Chapter 11.  Large amounts of data are often stored in a database—an organized collection of data.  A database management system (DBMS) provides mechanisms.
Functional Programming Data Aggregation and Nested Queries Ivan Yonkov Technical Trainer Software University
Building Web Applications with Microsoft ASP
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2016
Introduction to LINQ and Generic Collections
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2013
CIS 200 Test 01 Review.
Lambda Expressions By Val Feldsher.
Intro to LINQ Part 2 – Concepts and LINQ to Objects
Language Integrated Query: (LINQ) An introduction
Upgrading Your C# Programming Skills to Be a More Effective Developer
Chapter 5 Function Basics
New Features in C# 3.0 LINQ Lambda Expressions Extension Methods
LINQ to DATABASE-2.
Advanced .NET Programming I 6th Lecture
Chapter 5 Function Basics
Introduction to LINQ Chapter 11 10/28/2015 Lect 4 CT1411.
Language Integrated Query (LINQ)
LINQ to DATABASE-2.
Introduction to LINQ Chapter 11.
MIS Professor Sandvig MIS 324 Professor Sandvig
A simple function.
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises UTPA – Fall 2012 This set of slides is revised from lecture.
Advanced .NET Programming I 7th Lecture
Advanced .NET Programming I 6th Lecture
CS4540 Special Topics in Web Development LINQ to Objects
Presentation transcript:

LINQ - 2 Ravi Kumar C++/C# Team

A LINQ Query (once again)…

Anonymous Types! New “on the fly” class with read-only properties. var p = new { X = 0, Y = 1 }; Console.WriteLine("(X,Y) Coords = ({0},{1})", p.X, p.Y); Console.WriteLine("The typename is {0}",p.GetType().Name); <>f__AnonymousType1`2[System.Int32,System.Int32].

Query Expression! Set of clauses written in a new declarative syntax (SQL like). Starts with: From clause. Must end with: select or group clause. Type-checked. More clause: where, orderby, join. (etc..) Source of QE: IEnumerable. Returns: IEnumerable<T>

Contextual Keywords! New QE clauses. Keywords in context of QE. E.g.: From, select, etc… Keywords in context of QE. int from = 0; OK Var x = from c in customer Where c.Name == “ME” Select new {c.Name, c.Age}; Query Expression

QE -> Method Invocation List<int> scores = new List<int> { 77, 98, 92, 85, 80 }; IEnumerable<int> query = from score in scores where score >= 90 select score; Compiler translation List<int> scores = new List<int> { 77, 98, 92, 85, 80 }; var query = scores.Where(score => score >= 90).Select(score => score); where and select are ext methods in System.Linq.Enumerable namespace.

Translation of QE! Source object. (scores) where clause -> Where(…) from score in scores where score >= 90 select score; Source object. (scores) where clause -> Where(…) Parameter -> lambda exp with variable and exp in clause scores.Where( score => score >= 90) Enumerable.Where<int>( Func<int,bool>). Select clause -> Select(…)

Standard Query Operators System.Linq.Enumerable class. Example: Where(), Select(), OrderBy(), Distinct(), Average(), Max(), Min() etc… These Extension methods are collectively known as the Standard Query Operators. http://msdn2.microsoft.com/en-us/vcsharp/aa336746.aspx

Expression Trees… Data representation of the code that a C# lambda expression would execute if the expression were compiled to IL. parsing which the compiler generates executable code. Parsed code that has not been compiled to IL.

Lets LINQ Together!!