O'Reilly logo

Beginning Visual C# 2012 Programming by Christian Nagel, Daniel Kemper, Morgan Skinner, Jon Reid, Jacob Vibe Hammer, Karli Watson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 24

Applying LINQ

WHAT YOU WILL LEARN IN THIS CHAPTER

  • LINQ varieties
  • How to use LINQ with databases
  • How to navigate database relationships
  • How to use LINQ with XML
  • How to use LINQ to XML constructors
  • How to generate XML from databases
  • How to work with XML fragments

The previous chapter introduced LINQ (Language-Integrated Query) and showed how LINQ works with objects. This chapter teaches you how to apply LINQ to queries and manipulate data from different data sources such as databases and XML (Extensible Markup Language).

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

The wrox.com code downloads for this chapter are found at www.wrox.com/remtitle.cgi?isbn=9781118314418 on the Download Code tab. The code is in the Chapter 24 download and individually named according to the names throughout the chapter.

LINQ VARIETIES

Visual Studio 2012 and the .NET Framework 4.5 come with a number of built-in LINQ capabilities that provide query solutions for different types of data:

  • LINQ to Objects — Provides queries on any kind of C# in-memory object, such as arrays, lists, and other collection types. All of the examples in the previous chapter use LINQ to Objects. However, you can use the techniques you learn in this chapter with all of the varieties of LINQ.
  • LINQ to XML — Provides creation and manipulation of XML documents using the same syntax and general query mechanism as the other LINQ varieties.
  • LINQ to ADO.NET — ADO.NET or Active Data Objects for .NET is an umbrella term that includes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required