SlideShare a Scribd company logo
1 of 32
Language Integrated Query (LINQ) Nguyen Minh Dao [email_address]
Introduction ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object]
2006 2007 2008 .NET Framework - VS Roadmap ,[object Object],3.0 RTM 3.5 RTM ,[object Object],[object Object],ASP.NET AJAX 1.0 SQL Server 2008  ADO.NET Entity Framework ,[object Object],[object Object]
What is the .NET Framework 3.5? .NET Framework 2.0  + SP1 Windows Presentation Foundation Windows Communication Foundation Windows Workflow Foundation  Windows CardSpace .NET Framework 3.0 + SP1 .NET Framework 3.5 LINQ ASP.NET  3.5 CLR Add-in  Framework Additional Enhancements
Multi-targeting in Visual Studio 2008
Compiler Features ,[object Object],VB9 XML Literals Relaxed Delegates C# 3.0 Extension Methods Object Initialisers Anonymous Types Local Type Inference Lambda expressions Collection Initializers Partial Methods Automatic Properties If Ternary Operator Nullable Syntax Lambda statements
Language Innovations var contacts = from c in customers where c.City == "Hove" select new { c.Name, c.Phone }; var contacts = customers .Where(c => c.City == "Hove") .Select(c => new { c.Name, c.Phone }); Extension methods Lambda expressions Query expressions Object initializers Anonymous types Local variable type inference
Extension methods ,[object Object],[object Object],[object Object],string  name =  “Bart” ; string  reversed = name.Reverse(); static class  MyExtensions  {   public static string  Reverse( this string  s) {   char [] c = s.ToCharArray();   Array .Reverse(c);   return new string (c);   } } Promoted first parameter string  name =  “Bart” ; string  reversed =  MyExtensions .Reverse(name); static class  MyExtensions  {   public static string  Reverse( string  s) {   char [] c = s.ToCharArray();   Array .Reverse(c);   return new string (c);   } }
Automatic properties ,[object Object],[object Object],class  Customer  {   private string  _name;     public string  Name   {   get  {  return  _name; };   set  { _name =  value ; };   } } class  Customer  {   public string  Name {  get ;  set ; } } Setter required; can be private or internal
Object initializers ,[object Object],[object Object],[object Object],class  Customer  {   public string  Name {  get ;  set ; }   public int  Age {  get ;  set ; } } Customer   c =  new  Customer (); c.Name =  “Bart” ; c.Age = 24; var  c =  new  Customer (){ Name =  “Bart” , Age = 24}; Can be combined with any constructor call
Collection initializers ,[object Object],int [] ints =  new int [] { 1, 2, 3 }; List < int > lst =  new   List < int >(); lst.Add(1); lst.Add(2); lst.Add(3); int [] ints =  new int [] { 1, 2, 3 }; var  lst =  new   List < int >() { 1, 2, 3 }; Works for any ICollection class by calling its Add method
Anonymous types ,[object Object],[object Object],[object Object],[object Object],var  person =  new  { Name =  “Bart” , Age = 24 }; var  customer =  new  { Id = id, person.Name };
Lambda expressions ,[object Object],delegate  R  BinOp <A,B,R>(A a, B b);  int  Calc( BinOp < int ,  int ,  int > f,  int  a,  int  b) {   return  f(a, b) } int  result = Calc(   delegate  ( int  a,  int  b) {  return  a + b; },   1, 2); var  result = Calc((a, b) => a + b, 1, 2); Parameter types inferred based on the target delegate
Demo  Anonymous types, automatic properties, collection initializers, extension methods
First, A Taste of LINQ using  System; using  System.Query; using  System.Collections.Generic;   class   app  { static void  Main() { string [] names = { &quot;Burke&quot;, &quot;Connor&quot;,    &quot;Frank&quot;, &quot;Everett&quot;,      &quot;Albert&quot;, &quot;George&quot;,  &quot;Harris&quot;, &quot;David&quot; };   var  expr =  from  s  in  names  where  s.Length == 5 orderby  s select  s.ToUpper();   foreach  ( string  item  in  expr) Console .WriteLine(item); } } BURKE DAVID FRANK
Query Expressions ,[object Object],[object Object],from  itemName  in  srcExpr join  itemName  in  srcExpr  on  keyExpr  equals  keyExpr  (into  itemName )? let  itemName  =  selExpr where  predExpr orderby ( keyExpr  (ascending | descending)?)* select  selExpr group  selExpr  by  keyExpr   into  itemName query-body
LINQ  Architecture LINQ-enabled data sources LINQ  To Objects LINQ  To XML LINQ-enabled ADO.NET Visual Basic Others LINQ  To Entities LINQ  To SQL LINQ  To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
LINQ  Architecture LINQ-enabled data sources LINQ  To Objects LINQ  To XML LINQ-enabled ADO.NET Visual Basic Others LINQ  To Entities LINQ  To SQL LINQ  To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
LINQ to Objects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],using  System; using  System.Query; using  System.Collections.Generic;   class   app  { static void  Main() { string [] names = { &quot;Burke&quot;, &quot;Connor&quot;,    &quot;Frank&quot;, &quot;Everett&quot;,      &quot;Albert&quot;, &quot;George&quot;,  &quot;Harris&quot;, &quot;David&quot; };    Func < string ,  bool > filter = s => s.Length == 5; Func < string ,  string > extract = s => s; Func < string ,  string > project = s = s.ToUpper();   IEnumerable < string > expr = names .Where(filter)  .OrderBy(extract) .Select(project);   foreach  ( string  item  in  expr) Console .WriteLine(item); } } BURKE DAVID FRANK using  System; using  System.Query; using  System.Collections.Generic;   class   app  { static void  Main() { string [] names = { &quot;Allen&quot;, &quot;Arthur&quot;,    &quot;Bennett&quot; };   IEnumerable < string > ayes = names .Where(s => s[0] == 'A');   foreach  ( string  item  in  ayes)  Console .WriteLine(item);   names[0] = &quot;Bob&quot;;   foreach  ( string  item  in  ayes)  Console .WriteLine(item); } } Arthur using  System; using  System.Query; using  System.Collections.Generic;   class   app  { static void  Main() { string [] names = { &quot;Allen&quot;, &quot;Arthur&quot;,    &quot;Bennett&quot; };   IEnumerable < string > ayes = names .Where(s => s[0] == 'A');   foreach  ( string  item  in  ayes)  Console .WriteLine(item);   names[0] = &quot;Bob&quot;;   foreach  ( string  item  in  ayes)  Console .WriteLine(item); } } Allen Arthur using  System; using  System.Query; using  System.Collections.Generic;   class   app  { static void  Main() { string [] names = { &quot;Burke&quot;, &quot;Connor&quot;,    &quot;Frank&quot;, &quot;Everett&quot;,      &quot;Albert&quot;, &quot;George&quot;,  &quot;Harris&quot;, &quot;David&quot; };   IEnumerable < string > expr =  from  s  in  names  where  s.Length == 5 orderby  s select  s.ToUpper();   foreach  ( string  item  in  expr) Console .WriteLine(item); } } BURKE DAVID FRANK
LINQ  Architecture LINQ-enabled data sources LINQ  To Objects LINQ  To XML LINQ-enabled ADO.NET Visual Basic Others LINQ  To Entities LINQ  To SQL LINQ  To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
LINQ to SQL Overview
LINQ to SQL Architecture Enumerate SQL Query or SProc Rows Objects SubmitChanges() DML  or SProcs Application LINQ to SQL from c in db.Customers where c.City == &quot;London&quot; select c.CompanyName SELECT CompanyName FROM Customer WHERE City = 'London' db.Customers.Add(c1); c2.City = “Seattle&quot;; db.Customers.Remove(c3); INSERT INTO Customer … UPDATE Customer … DELETE FROM Customer …
LINQ to SQL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
LINQ to DataSet ,[object Object],[object Object],[object Object],[object Object],[object Object]
Demo   LINQ to Objects LINQ to SQL
LINQ  Architecture LINQ-enabled data sources LINQ  To Objects LINQ  To XML LINQ-enabled ADO.NET Visual Basic Others LINQ  To Entities LINQ  To SQL LINQ  To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
LINQ to XML ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Demo   LINQ to  XML
That’s LINQ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MSDN in the UK ,[object Object],[object Object],[object Object],[object Object],[object Object]
THANK YOU

More Related Content

What's hot

Bài Giảng Hiểu Dữ Liệu Và Tiền Xử Lý Dữ Liệu
Bài Giảng Hiểu Dữ Liệu Và Tiền Xử Lý Dữ Liệu Bài Giảng Hiểu Dữ Liệu Và Tiền Xử Lý Dữ Liệu
Bài Giảng Hiểu Dữ Liệu Và Tiền Xử Lý Dữ Liệu nataliej4
 
Hd th sql server_tuan5_n_khanh
Hd th sql server_tuan5_n_khanhHd th sql server_tuan5_n_khanh
Hd th sql server_tuan5_n_khanhHai Rom
 
Bài 2: Các khái niệm trong CSDL quan hệ - Giáo trình FPT
Bài 2: Các khái niệm trong CSDL quan hệ - Giáo trình FPTBài 2: Các khái niệm trong CSDL quan hệ - Giáo trình FPT
Bài 2: Các khái niệm trong CSDL quan hệ - Giáo trình FPTMasterCode.vn
 
Bài giảng Bảng tuần hoàn hóa học
Bài giảng Bảng tuần hoàn hóa họcBài giảng Bảng tuần hoàn hóa học
Bài giảng Bảng tuần hoàn hóa họcLong Vu
 
Thuật toán Brich , Khai phá dữ liệu
Thuật toán Brich , Khai phá dữ liệu Thuật toán Brich , Khai phá dữ liệu
Thuật toán Brich , Khai phá dữ liệu Lương Bá Hợp
 
C3 danh sachlienket
C3 danh sachlienketC3 danh sachlienket
C3 danh sachlienkethiep0109
 
Bài tập thiết kế cơ sở dữ liệu
Bài tập thiết kế cơ sở dữ liệuBài tập thiết kế cơ sở dữ liệu
Bài tập thiết kế cơ sở dữ liệuLê Minh
 
Nhận thức của sinh viên khoa Giáo dục mầm non trường Đại học Sư phạm về chuẩn...
Nhận thức của sinh viên khoa Giáo dục mầm non trường Đại học Sư phạm về chuẩn...Nhận thức của sinh viên khoa Giáo dục mầm non trường Đại học Sư phạm về chuẩn...
Nhận thức của sinh viên khoa Giáo dục mầm non trường Đại học Sư phạm về chuẩn...Dịch vụ Làm Luận Văn 0936885877
 
Hướng dẫn lập trình quản lý c#
Hướng dẫn lập trình quản lý c#Hướng dẫn lập trình quản lý c#
Hướng dẫn lập trình quản lý c#An Nguyen
 
91684060 356-cau-trắc-nghiệm-csdl-2
91684060 356-cau-trắc-nghiệm-csdl-291684060 356-cau-trắc-nghiệm-csdl-2
91684060 356-cau-trắc-nghiệm-csdl-2tranquanthien
 
Bài 4: Lập trình với CSDL ADO.NET & Kiến trúc không kết nối & Lập trình giao ...
Bài 4: Lập trình với CSDL ADO.NET & Kiến trúc không kết nối & Lập trình giao ...Bài 4: Lập trình với CSDL ADO.NET & Kiến trúc không kết nối & Lập trình giao ...
Bài 4: Lập trình với CSDL ADO.NET & Kiến trúc không kết nối & Lập trình giao ...MasterCode.vn
 
phân tích thiết kế hệ thống thông tin
phân tích thiết kế hệ thống thông tinphân tích thiết kế hệ thống thông tin
phân tích thiết kế hệ thống thông tinQuynh michelanh quynh
 
Bài 1: Một số khái niệm cơ bản
Bài 1: Một số khái niệm cơ bảnBài 1: Một số khái niệm cơ bản
Bài 1: Một số khái niệm cơ bảnChâu Trần
 
Bai giang atbmtt
Bai giang atbmtt Bai giang atbmtt
Bai giang atbmtt Hà Vũ
 
Vận dụng phương pháp dạy học theo hướng tích cực hoá người học cho môn thiết ...
Vận dụng phương pháp dạy học theo hướng tích cực hoá người học cho môn thiết ...Vận dụng phương pháp dạy học theo hướng tích cực hoá người học cho môn thiết ...
Vận dụng phương pháp dạy học theo hướng tích cực hoá người học cho môn thiết ...https://www.facebook.com/garmentspace
 

What's hot (20)

Bài Giảng Hiểu Dữ Liệu Và Tiền Xử Lý Dữ Liệu
Bài Giảng Hiểu Dữ Liệu Và Tiền Xử Lý Dữ Liệu Bài Giảng Hiểu Dữ Liệu Và Tiền Xử Lý Dữ Liệu
Bài Giảng Hiểu Dữ Liệu Và Tiền Xử Lý Dữ Liệu
 
Hd th sql server_tuan5_n_khanh
Hd th sql server_tuan5_n_khanhHd th sql server_tuan5_n_khanh
Hd th sql server_tuan5_n_khanh
 
Bài 2: Các khái niệm trong CSDL quan hệ - Giáo trình FPT
Bài 2: Các khái niệm trong CSDL quan hệ - Giáo trình FPTBài 2: Các khái niệm trong CSDL quan hệ - Giáo trình FPT
Bài 2: Các khái niệm trong CSDL quan hệ - Giáo trình FPT
 
Bài giảng Bảng tuần hoàn hóa học
Bài giảng Bảng tuần hoàn hóa họcBài giảng Bảng tuần hoàn hóa học
Bài giảng Bảng tuần hoàn hóa học
 
Thuật toán Brich , Khai phá dữ liệu
Thuật toán Brich , Khai phá dữ liệu Thuật toán Brich , Khai phá dữ liệu
Thuật toán Brich , Khai phá dữ liệu
 
C2 1
C2 1C2 1
C2 1
 
C3 danh sachlienket
C3 danh sachlienketC3 danh sachlienket
C3 danh sachlienket
 
Bài tập thiết kế cơ sở dữ liệu
Bài tập thiết kế cơ sở dữ liệuBài tập thiết kế cơ sở dữ liệu
Bài tập thiết kế cơ sở dữ liệu
 
Nhận thức của sinh viên khoa Giáo dục mầm non trường Đại học Sư phạm về chuẩn...
Nhận thức của sinh viên khoa Giáo dục mầm non trường Đại học Sư phạm về chuẩn...Nhận thức của sinh viên khoa Giáo dục mầm non trường Đại học Sư phạm về chuẩn...
Nhận thức của sinh viên khoa Giáo dục mầm non trường Đại học Sư phạm về chuẩn...
 
Hướng dẫn lập trình quản lý c#
Hướng dẫn lập trình quản lý c#Hướng dẫn lập trình quản lý c#
Hướng dẫn lập trình quản lý c#
 
Data Warehouse
Data WarehouseData Warehouse
Data Warehouse
 
91684060 356-cau-trắc-nghiệm-csdl-2
91684060 356-cau-trắc-nghiệm-csdl-291684060 356-cau-trắc-nghiệm-csdl-2
91684060 356-cau-trắc-nghiệm-csdl-2
 
Bài 4: Lập trình với CSDL ADO.NET & Kiến trúc không kết nối & Lập trình giao ...
Bài 4: Lập trình với CSDL ADO.NET & Kiến trúc không kết nối & Lập trình giao ...Bài 4: Lập trình với CSDL ADO.NET & Kiến trúc không kết nối & Lập trình giao ...
Bài 4: Lập trình với CSDL ADO.NET & Kiến trúc không kết nối & Lập trình giao ...
 
phân tích thiết kế hệ thống thông tin
phân tích thiết kế hệ thống thông tinphân tích thiết kế hệ thống thông tin
phân tích thiết kế hệ thống thông tin
 
C4 1 tuan 14
C4 1 tuan 14C4 1 tuan 14
C4 1 tuan 14
 
Bài 1: Một số khái niệm cơ bản
Bài 1: Một số khái niệm cơ bảnBài 1: Một số khái niệm cơ bản
Bài 1: Một số khái niệm cơ bản
 
Luận văn: Thuật toán mã hóa văn bản có độ bảo mật cao, HOT
Luận văn: Thuật toán mã hóa văn bản có độ bảo mật cao, HOTLuận văn: Thuật toán mã hóa văn bản có độ bảo mật cao, HOT
Luận văn: Thuật toán mã hóa văn bản có độ bảo mật cao, HOT
 
Bai giang atbmtt
Bai giang atbmtt Bai giang atbmtt
Bai giang atbmtt
 
Hệ thống quản lý tiền lương và chất lượng giảng dạy của giảng viên
Hệ thống quản lý tiền lương và chất lượng giảng dạy của giảng viênHệ thống quản lý tiền lương và chất lượng giảng dạy của giảng viên
Hệ thống quản lý tiền lương và chất lượng giảng dạy của giảng viên
 
Vận dụng phương pháp dạy học theo hướng tích cực hoá người học cho môn thiết ...
Vận dụng phương pháp dạy học theo hướng tích cực hoá người học cho môn thiết ...Vận dụng phương pháp dạy học theo hướng tích cực hoá người học cho môn thiết ...
Vận dụng phương pháp dạy học theo hướng tích cực hoá người học cho môn thiết ...
 

Viewers also liked

Ling to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysisLing to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysisAlexander Konduforov
 
Linq to entity
Linq to entityLinq to entity
Linq to entitybuianhtai
 
20130329 introduction to linq
20130329 introduction to linq20130329 introduction to linq
20130329 introduction to linqLearningTech
 
Entity Framework - Queries
Entity Framework -  QueriesEntity Framework -  Queries
Entity Framework - QueriesEyal Vardi
 
Entity framework
Entity frameworkEntity framework
Entity frameworkicubesystem
 
Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)Eyal Vardi
 
メタプログラミング C#
メタプログラミング C#メタプログラミング C#
メタプログラミング C#Fujio Kojima
 
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~Fujio Kojima
 
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource GroupLINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource GroupShahzad
 

Viewers also liked (20)

Ling to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysisLing to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysis
 
Linq to entity
Linq to entityLinq to entity
Linq to entity
 
B_110500002
B_110500002B_110500002
B_110500002
 
20130329 introduction to linq
20130329 introduction to linq20130329 introduction to linq
20130329 introduction to linq
 
Linq e Ef
Linq e EfLinq e Ef
Linq e Ef
 
LINQ for absolute beginners
LINQ for absolute beginnersLINQ for absolute beginners
LINQ for absolute beginners
 
Linq
LinqLinq
Linq
 
Entity Framework - Queries
Entity Framework -  QueriesEntity Framework -  Queries
Entity Framework - Queries
 
Entity framework
Entity frameworkEntity framework
Entity framework
 
LINQ
LINQLINQ
LINQ
 
The Entity Data Model
The Entity Data ModelThe Entity Data Model
The Entity Data Model
 
Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)
 
LINQ and LINQPad
LINQ and LINQPadLINQ and LINQPad
LINQ and LINQPad
 
Think in linq
Think in linqThink in linq
Think in linq
 
PostCss
PostCssPostCss
PostCss
 
メタプログラミング C#
メタプログラミング C#メタプログラミング C#
メタプログラミング C#
 
RAII and ScopeGuard
RAII and ScopeGuardRAII and ScopeGuard
RAII and ScopeGuard
 
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
 
LINQ in C#
LINQ in C#LINQ in C#
LINQ in C#
 
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource GroupLINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
 

Similar to Linq intro

Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaJevgeni Kabanov
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008Luis Enrique
 
devLink - What's New in C# 4?
devLink - What's New in C# 4?devLink - What's New in C# 4?
devLink - What's New in C# 4?Kevin Pilch
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET componentsBình Trọng Án
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateKiev ALT.NET
 
Language Integrated Query By Nyros Developer
Language Integrated Query By Nyros DeveloperLanguage Integrated Query By Nyros Developer
Language Integrated Query By Nyros DeveloperNyros Technologies
 
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05CHOOSE
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharpg_hemanth17
 
Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1Sachin Singh
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpRaga Vahini
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpSatish Verma
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpsinghadarsh
 
Introduction to CSharp
Introduction to CSharpIntroduction to CSharp
Introduction to CSharpMody Farouk
 
Introduction to-csharp
Introduction to-csharpIntroduction to-csharp
Introduction to-csharpSDFG5
 
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...NALESVPMEngg
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.pptAlmamoon
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.pptmothertheressa
 

Similar to Linq intro (20)

PostThis
PostThisPostThis
PostThis
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
 
TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
devLink - What's New in C# 4?
devLink - What's New in C# 4?devLink - What's New in C# 4?
devLink - What's New in C# 4?
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET components
 
Understanding linq
Understanding linqUnderstanding linq
Understanding linq
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicate
 
Language Integrated Query By Nyros Developer
Language Integrated Query By Nyros DeveloperLanguage Integrated Query By Nyros Developer
Language Integrated Query By Nyros Developer
 
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharp
 
Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to CSharp
Introduction to CSharpIntroduction to CSharp
Introduction to CSharp
 
Introduction to-csharp
Introduction to-csharpIntroduction to-csharp
Introduction to-csharp
 
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.ppt
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.ppt
 

More from Bình Trọng Án

A Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatRA Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatRBình Trọng Án
 
Nếu con em vị nói lắp
Nếu con em vị nói lắpNếu con em vị nói lắp
Nếu con em vị nói lắpBình Trọng Án
 
Bài giảng chuyên đề - Lê Minh Hoàng
Bài giảng chuyên đề - Lê Minh HoàngBài giảng chuyên đề - Lê Minh Hoàng
Bài giảng chuyên đề - Lê Minh HoàngBình Trọng Án
 
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ địnhCác câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ địnhBình Trọng Án
 
2816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-12816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-1Bình Trọng Án
 
Tỷ lệ vàng - một phát hiện vĩ đại của hình học
Tỷ lệ vàng - một phát hiện vĩ đại của hình họcTỷ lệ vàng - một phát hiện vĩ đại của hình học
Tỷ lệ vàng - một phát hiện vĩ đại của hình họcBình Trọng Án
 
Sách chữa tật nói lắp Version 1.0 beta
Sách chữa tật nói lắp Version 1.0 betaSách chữa tật nói lắp Version 1.0 beta
Sách chữa tật nói lắp Version 1.0 betaBình Trọng Án
 
Displaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSLDisplaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSLBình Trọng Án
 

More from Bình Trọng Án (19)

A Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatRA Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatR
 
Nếu con em vị nói lắp
Nếu con em vị nói lắpNếu con em vị nói lắp
Nếu con em vị nói lắp
 
Bài giảng chuyên đề - Lê Minh Hoàng
Bài giảng chuyên đề - Lê Minh HoàngBài giảng chuyên đề - Lê Minh Hoàng
Bài giảng chuyên đề - Lê Minh Hoàng
 
Tìm hiểu về NodeJs
Tìm hiểu về NodeJsTìm hiểu về NodeJs
Tìm hiểu về NodeJs
 
Clean code-v2.2
Clean code-v2.2Clean code-v2.2
Clean code-v2.2
 
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ địnhCác câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ định
 
Luyện dịch Việt Anh
Luyện dịch Việt AnhLuyện dịch Việt Anh
Luyện dịch Việt Anh
 
2816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-12816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-1
 
LinQ to XML
LinQ to XMLLinQ to XML
LinQ to XML
 
Chuyên đề group policy
Chuyên đề group policyChuyên đề group policy
Chuyên đề group policy
 
Chapter 4 xml schema
Chapter 4   xml schemaChapter 4   xml schema
Chapter 4 xml schema
 
Tỷ lệ vàng - một phát hiện vĩ đại của hình học
Tỷ lệ vàng - một phát hiện vĩ đại của hình họcTỷ lệ vàng - một phát hiện vĩ đại của hình học
Tỷ lệ vàng - một phát hiện vĩ đại của hình học
 
Ajax Control ToolKit
Ajax Control ToolKitAjax Control ToolKit
Ajax Control ToolKit
 
Sách chữa tật nói lắp Version 1.0 beta
Sách chữa tật nói lắp Version 1.0 betaSách chữa tật nói lắp Version 1.0 beta
Sách chữa tật nói lắp Version 1.0 beta
 
Mô hình 3 lớp
Mô hình 3 lớpMô hình 3 lớp
Mô hình 3 lớp
 
Xsd examples
Xsd examplesXsd examples
Xsd examples
 
Displaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSLDisplaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSL
 
Tp2
Tp2Tp2
Tp2
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 

Recently uploaded

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Linq intro

  • 1. Language Integrated Query (LINQ) Nguyen Minh Dao [email_address]
  • 2.
  • 3.
  • 4.
  • 5. What is the .NET Framework 3.5? .NET Framework 2.0 + SP1 Windows Presentation Foundation Windows Communication Foundation Windows Workflow Foundation Windows CardSpace .NET Framework 3.0 + SP1 .NET Framework 3.5 LINQ ASP.NET 3.5 CLR Add-in Framework Additional Enhancements
  • 7.
  • 8. Language Innovations var contacts = from c in customers where c.City == &quot;Hove&quot; select new { c.Name, c.Phone }; var contacts = customers .Where(c => c.City == &quot;Hove&quot;) .Select(c => new { c.Name, c.Phone }); Extension methods Lambda expressions Query expressions Object initializers Anonymous types Local variable type inference
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. Demo Anonymous types, automatic properties, collection initializers, extension methods
  • 16. First, A Taste of LINQ using System; using System.Query; using System.Collections.Generic;   class app { static void Main() { string [] names = { &quot;Burke&quot;, &quot;Connor&quot;, &quot;Frank&quot;, &quot;Everett&quot;, &quot;Albert&quot;, &quot;George&quot;, &quot;Harris&quot;, &quot;David&quot; };   var expr = from s in names where s.Length == 5 orderby s select s.ToUpper();   foreach ( string item in expr) Console .WriteLine(item); } } BURKE DAVID FRANK
  • 17.
  • 18. LINQ Architecture LINQ-enabled data sources LINQ To Objects LINQ To XML LINQ-enabled ADO.NET Visual Basic Others LINQ To Entities LINQ To SQL LINQ To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
  • 19. LINQ Architecture LINQ-enabled data sources LINQ To Objects LINQ To XML LINQ-enabled ADO.NET Visual Basic Others LINQ To Entities LINQ To SQL LINQ To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
  • 20.
  • 21. LINQ Architecture LINQ-enabled data sources LINQ To Objects LINQ To XML LINQ-enabled ADO.NET Visual Basic Others LINQ To Entities LINQ To SQL LINQ To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
  • 22. LINQ to SQL Overview
  • 23. LINQ to SQL Architecture Enumerate SQL Query or SProc Rows Objects SubmitChanges() DML or SProcs Application LINQ to SQL from c in db.Customers where c.City == &quot;London&quot; select c.CompanyName SELECT CompanyName FROM Customer WHERE City = 'London' db.Customers.Add(c1); c2.City = “Seattle&quot;; db.Customers.Remove(c3); INSERT INTO Customer … UPDATE Customer … DELETE FROM Customer …
  • 24.
  • 25.
  • 26. Demo LINQ to Objects LINQ to SQL
  • 27. LINQ Architecture LINQ-enabled data sources LINQ To Objects LINQ To XML LINQ-enabled ADO.NET Visual Basic Others LINQ To Entities LINQ To SQL LINQ To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
  • 28.
  • 29. Demo LINQ to XML
  • 30.
  • 31.