module 3: introduction to linq (powerpoint slides)
DESCRIPTION
Module 3: Introduction to LINQ (PowerPoint Slides)Jordan .NET User Group (Jordev)Community MaterialMohamed SalehTRANSCRIPT
![Page 1: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/1.jpg)
Visual Studio 2008 Training
3.5 RTM3.5 RTM
Mohamed [email protected]
www.jordev.netwww.geeksconnected.com/mohamed
![Page 2: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/2.jpg)
Module 3: Introduction To Linq
![Page 3: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/3.jpg)
Overview
What is Linq
Understand the Query Expressions and Query Operators
Writing queries using extension methods
Using the Partitioning and Conversion operators
Explain the usage of the new Linq Assemblies
Enabling Linq to Objects for .Net Framework 2.0
![Page 4: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/4.jpg)
Introducing LINQ Project
Linq is a set of language extensions that enable the query operations over the data.
Linq relies on the C# 3.0 Language Enhancements .
Linq Building Blocks:1. Object Initializers
2. Lambda Expressions
3. Extension Methods
4. Anonymous types
5. Implicit Typing Variables
LINQ Project Overview
![Page 5: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/5.jpg)
LINQ Assemblies
The following describes the new assemblies and its use:• System.Core.dll: Extension Methods for IEnumerable<T> .
• System.Data.DataExtensions.dll: Providing LINQ for DataSet.
• System.Data.Linq.dll: LINQ implementation for SQL Server.
• System.Xml.Linq.dll: LINQ Implementation for XML
LINQ Assemblies
![Page 6: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/6.jpg)
LINQ Query Expressions
What is Query?
What is Query Operators?
How to Write Query Expressions?
IEnumerable<T> and Query Results
What is Deferred Execution?
What is Immediate Execution?
LINQ Query Expressions
![Page 7: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/7.jpg)
Lab 1: Writing Query Expressions
Writing Linq Query Expression.
Using Query Operators.
Using var and IEnumerable<T> query varaiables.
Querying In-Memory Collections.
![Page 8: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/8.jpg)
Standard Query Operators
The System.Linq namespace contains different Linq Extensions under the System.Linq.Enumerable class.
Commonly Used Operators:1. OrderByDescending
2. OrderBy
3. Take
4. Sum
5. Distinct
6. Count
7. First
Standard Query Operators Overview
![Page 9: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/9.jpg)
Lab 2: Using Initializers
Writing Queries using Linq Extension Methods.
Sorting the elements using the OrderByDescending extension method.
Returning specific elements using Take and First methods.
Calculating the total number of elements using the Count method.
Returning Distinct values from a sequence of values.
![Page 10: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/10.jpg)
Conversion Operators
The conversion operator enable the conversion of query results into different collection types.
The query conversion operators:
1. ToArray
2. ToList
3. ToDictionary
4. OfType
Conversion Operators Overview
![Page 11: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/11.jpg)
Lab 3: Using Conversion Operators
Enforce the immediate execution of the queries.
Converting the query results to Different Collection Types.
Filtering the query results based on a specific data type.
![Page 12: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/12.jpg)
Partitioning Operators
Linq extension methods set contain a group of operators that allows the programmer to partitioning the results of the query into a specific sequence.
The query partitioning operators:1. Take
2. Skip
3. TakeWhile
4. SkipWhile
Partitioning Operators Overview
![Page 13: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/13.jpg)
Lab 4: Using Partitioning Operators
Use the partitioning query operators.
Skipping elements based on conditional expression.
Retrieving elements using Take and TakeWhile operators.
![Page 14: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/14.jpg)
LINQ Bridge
LINQ Implemented for .NET 3.5, which requires the client to install .NET Framework 3.5.
LINQBridge is an open project contains a reimplementation for all standard query operators
LINQBridge utilize the Csharp 3.0 Compiler new features to enable LINQ for .NET 2.0 Applications.
LINQBridge can be used in Visual Studio 2008 for writing LINQ to Objects expressions.
LINQBridge can be used in Visual Studio 2005 using the extension methods style.
LINQ Bridge Overview
![Page 15: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/15.jpg)
Lab 5: Using LINQ for .NET Framework 2.0
Writing Linq-Enabled Applications for .NET Framework 2.0.
Using the LinqBridge Extension in Visual Studio 2008.
Writing Linq to Objects expressions.
![Page 16: Module 3: Introduction to LINQ (PowerPoint Slides)](https://reader035.vdocument.in/reader035/viewer/2022062307/554eba6ab4c905de468b4677/html5/thumbnails/16.jpg)
Review
In this module, you learned to:In this module, you learned to:
Writing Query Expressions
Writing Queries using extension methods directly
Using different query operators
Enabling Linq to Objects into .NET Framework 2.0 Applications
Writing Query Expressions
Writing Queries using extension methods directly
Using different query operators
Enabling Linq to Objects into .NET Framework 2.0 Applications