This documentation is archived and is not being maintained.

LINQ C# Samples

.NET Framework 3.5

Samples that demonstrate LINQ technologies in C# are provided on the local drive under the <drive>:\Program Files\Microsoft Visual Studio 9.0\Sample folder and at the following online locations:

Visual Studio 2008 Samples page

Visual C# Developer Center

Instructions for opening and running the samples are also located online.

Sample Queries

Provides examples of query operations for LINQ to Objects, LINQ to SQL, LINQ to XML, and LINQ to DataSet.

Data Sample

Designed to support many of the scenarios demonstrated in various LINQ samples.

NorthwindMapping Sample

Generates object-relational mapping files used by some other samples.

Simple LINQ to Objects Sample

Shows how to query an in-memory collection.

Dynamic Query Sample

Illustrates how to create LINQ queries dynamically at runtime.

Expression Tree Visualizer Sample

Provides a working implementation of a visualizer that can be run inside the Visual Studio debugger to view the contents of an expression tree.

LINQ to Northwind Sample

Provides examples of using LINQ to SQL to query a database.

LINQ Query Visualizer Sample

Small application that you can run in debug mode inside Visual Studio to test the Expression Tree Visualizer.

Object Dumper Sample

A library that you can add to your solution to output the results of LINQ queries for testing.

Paste XML as LINQ Sample

Demonstrates a Visual Studio add-in that translates an XML code example to the C# code that produces equivalent XML in the LINQ to XML API.

Reflector Sample

Generates an HTML document that outlines the public API for a given assembly.

RSS Sample

Acts as a small Web server that aggregates several RSS feeds.

Simple Lambdas Sample

Provides examples of simple lambda expressions.

Windows Forms Data Binding Sample

Demonstrates how to use LINQ in Windows Forms data-binding scenarios.

Introduction to LINQ to XML Sample

Demonstrates key concepts about LINQ to XML.

XQuery Sample

Shows how to use LINQ to XML to solve the use cases in the XQuery standard.

LINQ to XML Databinding Sample

Demonstrates the LINQ to XML data binding to Windows Presentation Foundation (WPF) feature.

LINQ Sample Applications in Visual Basic

Descriptive information about the Visual Basic LINQ samples.


Provides a link to whitepapers that provide additional information about LINQ.

Language-Integrated Query (LINQ)

Includes a general explanation of LINQ and links to related technologies.