About the Tutorial
About the Tutorial
The acronym LINQ stands for Language Integrated Query. Microsoft's query language is fully integrated and offers easy data access from in-memory objects, databases, XML documents, and many more. It is through a set of extensions LINQ ably integrates queries in C# and Visual Basic. This tutorial offers a complete insight into LINQ with ample examples and coding. The entire tutorial is divided into various topics with subtopics that a beginner can be able to move gradually to more complex topics of LINQ.
Audience
The aim of this tutorial is to offer an easy understanding of LINQ to the beginners who are keen to learn the same.
Prerequisites
It is essential before proceeding to have some basic knowledge of C# and Visual Basic in .NET.
Copyright & Disclaimer
? Copyright 2018 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute, or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness, or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at contact@
i
LINQ
Table of Contents
About the Tutorial....................................................................................................................................i Audience ..................................................................................................................................................i Prerequisites ............................................................................................................................................i Copyright & Disclaimer.............................................................................................................................i Table of Contents ....................................................................................................................................ii
1. LINQ OVERVIEW ...............................................................................................................1
Example of a LINQ query .........................................................................................................................1 Syntax of LINQ.........................................................................................................................................2 Types of LINQ ..........................................................................................................................................3 LINQ Architecture in .NET........................................................................................................................3 Query Expressions...................................................................................................................................4 Extension Methods .................................................................................................................................5 Difference between LINQ and Stored Procedure .....................................................................................5 Need for LINQ .........................................................................................................................................5 Advantages of LINQ.................................................................................................................................6
2. LINQ ENVIRONMENT ........................................................................................................7
Getting Visual Studio 2010 Installed on Windows 7 ................................................................................7 Writing C# Program using LINQ in Visual Studio 2010 ...........................................................................11 Writing VB Program using LINQ in Visual Studio 2010 ...........................................................................13
3. LINQ QUERY OPERATORS................................................................................................15
Filtering Operators ................................................................................................................................15 Filtering Operators in LINQ....................................................................................................................16 Join Operators.......................................................................................................................................17 Join Operators in LINQ ..........................................................................................................................17 Projection Operations ...........................................................................................................................21
ii
LINQ
Projection Operations in LINQ...............................................................................................................21 Sorting Operators..................................................................................................................................25 Grouping Operators ..............................................................................................................................28 Conversions...........................................................................................................................................30 Concatenation ....................................................................................................................................... 33 Aggregation ........................................................................................................................................... 36 Quantifier Operations ...........................................................................................................................38 Partition Operators ...............................................................................................................................41 Generation Operations..........................................................................................................................45 Set Operations ......................................................................................................................................50 Equality .................................................................................................................................................56 Element Operators ................................................................................................................................58
4. LINQ SQL......................................................................................................................... 63
Introduction of LINQ To SQL..................................................................................................................63 How to Use LINQ to SQL? ......................................................................................................................64 Querying with LINQ to SQL....................................................................................................................66 Insert, Update, and Delete using LINQ to SQL .......................................................................................66
5. LINQ OBJECTS.................................................................................................................74
Introduction of LINQ to Objects ............................................................................................................74 Querying in Memory Collections Using LINQ to Objects ........................................................................75
6. LINQ DATASET ................................................................................................................78
Introduction of LINQ to Dataset ............................................................................................................78 Querying Dataset using LinQ to Dataset ................................................................................................81
7. LINQ XML........................................................................................................................85
Introduction of LINQ to XML .................................................................................................................85 Read an XML File using LINQ .................................................................................................................86
iii
LINQ
Add New Node ......................................................................................................................................88 Deleting Particular Node .......................................................................................................................90
8. LINQ ENTITIES.................................................................................................................93
LINQ to Entities Query Creation and Execution Process ........................................................................93 Example of ADD, UPDATE, and DELETE using LINQ with Entity Model...................................................94
9. LINQ LAMBDA EXPRESSIONS........................................................................................... 99
Expression Lambda .............................................................................................................................100 Async Lambdas....................................................................................................................................100 Lambda in Standard Query Operators .................................................................................................100 Type Inference in Lambda ...................................................................................................................102 Variable Scope in Lambda Expression .................................................................................................102 Expression Tree ...................................................................................................................................104 Statement Lambda..............................................................................................................................104
10. LINQ ............................................................................................................... 106
LINQDataSource Control .....................................................................................................................107 INSERT, UPDATE, and DELETE data in Page using LINQ..........................................................110
iv
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- c 3 linq cornell university
- iap c 2011 lecture 2 linq and concurrency
- query expression lambda expressions
- calling functions in linq queries
- about the tutorial
- introduction to linq language integrated query
- type inference 3 0 features components in linq
- linq language features for concurrency among other
- example of a linq query tutorialspoint
Related searches
- learning about the brain for kids
- all about the winter solstice
- facts about the equinox
- quotes about the meaning of life
- bad things about the internet
- essay about the importance of learning english
- information about the roman empire
- interesting facts about the workplace
- interesting facts about the uae
- fun facts about the uae
- sermon about the family
- essay about the importance of learning en