CSE459_CSharp_10_LINQ

CSE459_CSharp_10_LINQ - Programming in C LINQ CSE 459.24...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Programming in C# LINQ CSE 459.24 Prof. Roger Crawfis First, A Taste of LINQ using System; using System.Query; using System.Collections.Generic; class app { static void Main() { string names = { "Burke", "Connor", "Frank", "Everett", "Albert", "George", "Harris", "David" }; 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 Queries without LINQ foreach(Customer c in customers) if (c.Region == "USA") ... l Objects using loops and conditions //Customers/Customer[@Region='USA'] l XML using XPath/XQuery SELECT * FROM Customers WHERE Region='USA' l SELECT from database tables Key Features of LINQ l Delayed Execution l LINQ queries don't execute until they must l Retrieve specific values l Iterate through the collection l Perform an operation l Write Data Access Code directly l Compile time syntax and schema checking (intelli-sense too) l No need for inline sql and to wait until Language INtegrated Query LINQ enabled data sources LINQ To Objects Objects LINQ To XML <book> <title/> <author/> <price/> </book> XML LINQ enabled ADO.NET LINQ To Datasets LINQ To SQL LINQ To Entities Relational Others… VB C# .NET Language-Integrated Query LINQ provides one programming model for all types of data (objects, SQL, XML, LINQ Enabled Data Sources l LINQ to Objects l LINQ to SQL (formerly known as DLINQ) l LINQ to XML (formerly known as XLINQ) l LINQ to Entities (ADO.NET Entities) LINQ to Objects...
View Full Document

{[ snackBarMessage ]}

Page1 / 22

CSE459_CSharp_10_LINQ - Programming in C LINQ CSE 459.24...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online