Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Asp.net c# mvc Training-Day-5 of Day-9

281 views

Published on

Why LINQ?
LINQ Query & Method Syntax
Anatomy of the Lambda Expression
Standard Query Operators:
Expression in LINQ
Expression Tree
Immediate Execution of LINQ Query
let & into keyword
Sample LINQ Queries

Published in: Software
  • Be the first to comment

Asp.net c# mvc Training-Day-5 of Day-9

  1. 1. AHM Pervej Kabir Analyst Programmer pervej_kabir@yahoo.com Cell:+8801757051005 Day-5: 18 October 2017 ASP.Net C#- MVC-5 Training
  2. 2. Introduction  What is LINQ? Why LINQ? LINQ Query & Method Syntax Anatomy of the Lambda Expression Standard Query Operators: Expression in LINQ Expression Tree Immediate Execution of LINQ Query let & into keyword Sample LINQ Queries
  3. 3.  What Is LINQ LINQ (Language Integrated Query) is uniform query syntax in C# and VB.NET used to save and retrieve data from different sources. It is integrated in C# or VB, thereby eliminating the mismatch between programming languages and databases, as well as providing a single querying interface for different types of data sources.  For example, SQL is a Structured Query Language used to save and retrieve data from a database. In the same way, LINQ is a structured query syntax built in C# and VB.NET used to save and retrieve data from different types of data sources like an Object Collection, SQL server database, XML, web service etc.  LINQ always works with objects so you can use the same basic coding patterns to query and transform data in XML documents, SQL databases, ADO.NET Datasets, .NET collections, and any other format for which a LINQ provider is available.
  4. 4.  Why LINQ?  Familiar language: Developers don’t have to learn a new query language for each type of data source or data format.  Less coding: It reduces the amount of code to be written as compared with a more traditional approach.  Readable code: LINQ makes the code more readable so other developers can easily understand and maintain it.  Standardized way of querying multiple data sources: The same LINQ syntax can be used to query multiple data sources.  Compile time safety of queries: It provides type checking of objects at compile time.  IntelliSense Support: LINQ provides IntelliSense for generic collections.  Shaping data: You can retrieve data in different shapes.
  5. 5.  LINQ Query Syntax: Example:
  6. 6. Example: LINQ Method Syntax:
  7. 7. C# 3.0(.NET 3.5) introduced the lambda expression along with LINQ. Example: Lamda Expression:
  8. 8.  Standard Query Operators in query  Standard Query Operators in Method
  9. 9.  Where Clause:  Where Extension Method:
  10. 10.  Then By:  Group By:
  11. 11.  Joining
  12. 12.  Aggregate Function:
  13. 13.  Concatenation  Skip
  14. 14.  Expression:
  15. 15.  Invoke an Expression:
  16. 16.  Into Keyword:  Simple query:
  17. 17.  Multiple query:
  18. 18. 191

×