LINQ (How Do I in C#)
This topic links to help about Language-Integrated Query (LINQ). To view other categories of popular tasks covered in Help, see How Do I in C#.
- Getting Started with LINQ in C#
Provides background information about LINQ queries.
- Walkthrough: Writing Queries in C# (LINQ)
Provides examples of the basic LINQ query clauses.
- LINQ Query Expressions (C# Programming Guide)
Provides information about query expressions in C#, with examples and pointers to many code examples.
- How to: Use Expression Trees to Build Dynamic Queries
Shows how to build LINQ queries dynamically by using expression trees.
- Walkthrough: Creating an IQueryable LINQ Provider
Shows how to create a custom LINQ provider.
- How to: Query for Sentences that Contain a Specified Set of Words (LINQ)
Shows how to split text files on arbitrary boundaries and performing queries against each part.
- How to: Find the Set Difference Between Two Lists (LINQ)
Shows how to use the Except method to retrieve the items that are in one file but not the other.
- How to: Combine LINQ Queries with Regular Expressions
Shows how to use Regular Expressions in LINQ queries for complex pattern matching on filtered query results.
- How to: Compute Column Values in a CSV Text File (LINQ)
Shows how to perform mathematical computations on text data in .csv files.
- How to: Join Content from Dissimilar Files (LINQ)
Shows how to combine strings in two lists into a single string by using a matching key.
- How to: Reorder the Fields of a Delimited File (LINQ)
Shows how to reorder fields in a line in a csv file.
- How to: Query for Files with a Specified Attribute or Name
Shows how to search for files by examining one or more properties of its FileInfo object.
- How to: Group Files by Extension (LINQ)
Shows how to return groups of FileInfo object based on their file name extension.
- How to: Query for the Total Number of Bytes in a Set of Folders (LINQ)
Shows how to return the total number of bytes in all the files in a specified directory tree.
- How to: Compare the Contents of Two Folders (LINQ)s
Shows how to return all the files that are present in two specified folders, and also all the files that are present in one folder but not the other.
- How to: Query for the Largest File or Files in a Directory Tree (LINQ)
Shows how to return the largest or smallest file, or specified number of files, in a directory tree.
- How to: Query for Duplicate Files in a Directory Tree (LINQ)
Shows how to group for all file names that occur in more than one location in a specified directory tree. Also shows how to perform more complex comparisons, based on a custom comparer.
- How to: Query the Contents of Files in a Folder (LINQ)
Shows how to iterate through folders in a tree, open each file, and query the file's contents.
- How to: Query An Assembly's Metadata with Reflection (LINQ)
Shows how to use LINQ with reflection.
These are a few of the many code examples in the LINQ to SQL documentation. For more code examples, see Programming Guide (LINQ to SQL).
- Walkthrough: Simple Object Model and Query (C#) (LINQ to SQL)
Shows how to create an entity class and execute a simple query.
- N-Tier and Remote Applications with LINQ to SQL
Explains how to implement n-tier applications that use LINQ to SQL in the data access layer.
- Walkthrough: Querying Across Relationships (C#) (LINQ to SQL)
Shows how to query across tables that have been mapped into a hierarchical object relationship.
- Walkthrough: Manipulating Data (C#) (LINQ to SQL)
Shows how to add, update, delete and modify data in a database.
- Walkthrough: Simple Object Model and Query (C#) (LINQ to SQL)
Introduces the object-relational mapping concepts in LINQ to SQL.
- Walkthrough: Using Only Stored Procedures (C#) (LINQ to SQL)
Shows how to use stored procedures in LINQ to SQL.
- How to: Represent Primary Keys (LINQ to SQL)
Shows how to represent primary keys in LINQ to SQL.
- How to: Display Generated SQL (LINQ to SQL)
Shows how to display and view the SQL that is generated and issued to the database by the LINQ to SQL runtime.
- How to: Handle Composite Keys in Queries (LINQ to SQL)
Shows how to sort and group by composite key values.
- How to: Directly Execute SQL Queries (LINQ to SQL)
Shows how to issue SQL commands in place of a LINQ query.
- How to: Generate the Object Model in Visual Basic or C# (LINQ to SQL)
Describes how to use the SQLMetal command-line tool. Also provides Visual Studio users with a link to the Object Relational Designer.
- How to: Generate the Object Model as an External File (LINQ to SQL)
Describes how to generate an external mapping file instead of using attribute-based mapping.
- How to: Generate Customized Code by Modifying a DBML File (LINQ to SQL)
Describes how to generate Visual Basic or C# code from a DBML metadata file.
- How to: Validate DBML and External Mapping Files (LINQ to SQL)
Describes how to validate mapping files that you have modified (advanced).
- How to: Make Entities Serializable (LINQ to SQL)
Describes how to add appropriate attributes to make entities serializable.
- How to: Customize Entity Classes by Using the Code Editor (LINQ to SQL)
Describes how to use the code editor to write your own mapping code, or customize code that has been autogenerated.
- How to: Connect to a Database (LINQ to SQL)
Describes how to use the DataContext class to connect to a database.
- How to: Directly Execute SQL Commands (LINQ to SQL)
Describes how you can use ExecuteCommand to send SQL-language commands.
- How to: Reuse a Connection Between an ADO.NET Command and a DataContext (LINQ to SQL)
Provides examples of how to use an existing ADO.NET connection in a LINQ to SQL application.
- How to: Load XML from a File
Shows how to load XML from a URI using the Load method.
- Creating XML Trees
Shows how to create XML trees programmatically. Shows how to create XML with and without namespaces.
- Working with XML Namespaces
Shows how to work with XML namespaces.
- Modifying XML Trees (LINQ to XML)
Shows how to modify in-memory XML trees.
- Serializing to Files, TextWriters, and XmlWriters
Shows how to serialize XML trees to a variety of destinations.
- How to: Control Namespace Prefixes (C#) (LINQ to XML)
Shows how to control namespace prefixes when serializing.
- LINQ to XML Axes
Explains the axes. You must understand the axes in order to write queries.
- Querying XML Trees
Presents simple to complex queries, projections, and transformations that accomplish many common tasks.
- How to: Validate Using XSD (LINQ to XML)
Shows how to validate an XML tree using XSD.
- How to: Perform Streaming Transformations of Text to XML
Shows how to transform very large text files to XML while maintaining a small memory profile.
- How to: Retrieve Paragraphs from an Office Open XML Document
Shows how to open an Open XML document, and retrieve the paragraphs of it.
- How to: Populate an XML Tree from the File System
Shows how to populate an XML tree from the local file system.
- How to: Perform Streaming Transform of Large XML Documents
Shows how to transform very large XML documents while maintaining a small memory profile.
- Using XSLT to Transform an XML Tree
Shows how to use XSLT to transform an XML tree from one shape into another.
- Pure Functional Transformations of XML
Presents a tutorial that teaches how to perform pure functional transformations of XML.
- Loading Data Into a DataSet
Describes how to load data into a dataset.
- Single-Table Queries (LINQ to DataSet)
Describes how to perform queries against a single table in a dataset.
- Cross-Table Queries (LINQ to DataSet)
Describes how to perform queries across multiple tables in a dataset.
- Querying Typed DataSets
Describes how to perform queries against typed datasets.
- LINQ to DataSet Examples
Provides many examples of how to perform various query operations such as restriction, projection, ordering, partitioning, and so on.