Skip to content

Follow style guide #16259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/core/additional-tools/xml-serializer-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ Congratulations! You have just:
## Related resources

- [Introducing XML Serialization](../../standard/serialization/introducing-xml-serialization.md)
- [How to: Serialize Using XmlSerializer (C#)](../../csharp/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md)
- [How to serialize using XmlSerializer (C#)](../../csharp/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md)
- [How to: Serialize Using XmlSerializer (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md)
2 changes: 1 addition & 1 deletion docs/csharp/language-reference/keywords/from-clause.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ In the following example, `numbers` is the data source and `num` is the range va

## The range variable

The compiler infers the type of the range variable when the data source implements <xref:System.Collections.Generic.IEnumerable%601>. For example, if the source has a type of `IEnumerable<Customer>`, then the range variable is inferred to be `Customer`. The only time that you must specify the type explicitly is when the source is a non-generic `IEnumerable` type such as <xref:System.Collections.ArrayList>. For more information, see [How to: Query an ArrayList with LINQ](../../programming-guide/concepts/linq/how-to-query-an-arraylist-with-linq.md).
The compiler infers the type of the range variable when the data source implements <xref:System.Collections.Generic.IEnumerable%601>. For example, if the source has a type of `IEnumerable<Customer>`, then the range variable is inferred to be `Customer`. The only time that you must specify the type explicitly is when the source is a non-generic `IEnumerable` type such as <xref:System.Collections.ArrayList>. For more information, see [How to query an ArrayList with LINQ](../../programming-guide/concepts/linq/how-to-query-an-arraylist-with-linq.md).

In the previous example `num` is inferred to be of type `int`. Because the range variable is strongly typed, you can call methods on it or use it in other operations. For example, instead of writing `select num`, you could write `select num.ToString()` to cause the query expression to return a sequence of strings instead of integers. Or you could write `select num + 10` to cause the expression to return the sequence 14, 11, 13, 12, 10. For more information, see [select clause](select-clause.md).

Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/language-reference/keywords/group-clause.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Use a composite key when you want to group elements according to more than one k
group person by new {name = person.surname, city = person.city};
```

Use a named type if you must pass the query variable to another method. Create a special class using auto-implemented properties for the keys, and then override the <xref:System.Object.Equals%2A> and <xref:System.Object.GetHashCode%2A> methods. You can also use a struct, in which case you do not strictly have to override those methods. For more information see [How to implement a lightweight class with auto-implemented properties](../../programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md) and [How to: Query for Duplicate Files in a Directory Tree](../../programming-guide/concepts/linq/how-to-query-for-duplicate-files-in-a-directory-tree-linq.md). The latter article has a code example that demonstrates how to use a composite key with a named type.
Use a named type if you must pass the query variable to another method. Create a special class using auto-implemented properties for the keys, and then override the <xref:System.Object.Equals%2A> and <xref:System.Object.GetHashCode%2A> methods. You can also use a struct, in which case you do not strictly have to override those methods. For more information see [How to implement a lightweight class with auto-implemented properties](../../programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md) and [How to query for duplicate files in a directory tree](../../programming-guide/concepts/linq/how-to-query-for-duplicate-files-in-a-directory-tree-linq.md). The latter article has a code example that demonstrates how to use a composite key with a named type.

## Example

Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/misc/cs1934.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ static class Test

## See also

- [How to: Query an ArrayList with LINQ](../programming-guide/concepts/linq/how-to-query-an-arraylist-with-linq.md)
- [How to query an ArrayList with LINQ](../programming-guide/concepts/linq/how-to-query-an-arraylist-with-linq.md)
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ An aggregation operation computes a single value from a collection of values. An
- <xref:System.Linq>
- [Standard Query Operators Overview (C#)](./standard-query-operators-overview.md)
- [How to compute column values in a CSV text file (LINQ) (C#)](./how-to-compute-column-values-in-a-csv-text-file-linq.md)
- [How to: Query for the Largest File or Files in a Directory Tree (LINQ) (C#)](./how-to-query-for-the-largest-file-or-files-in-a-directory-tree-linq.md)
- [How to: Query for the Total Number of Bytes in a Set of Folders (LINQ) (C#)](./how-to-query-for-the-total-number-of-bytes-in-a-set-of-folders-linq.md)
- [How to query for the largest file or files in a directory tree (LINQ) (C#)](./how-to-query-for-the-largest-file-or-files-in-a-directory-tree-linq.md)
- [How to query for the total number of bytes in a set of folders (LINQ) (C#)](./how-to-query-for-the-total-number-of-bytes-in-a-set-of-folders-linq.md)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This topic gives a brief introduction to [!INCLUDE[vbteclinq](~/includes/vbtecli
The range variable is like the iteration variable in a `foreach` loop except that no actual iteration occurs in a query expression. When the query is executed, the range variable will serve as a reference to each successive element in `customers`. Because the compiler can infer the type of `cust`, you do not have to specify it explicitly. Additional range variables can be introduced by a `let` clause. For more information, see [let clause](../../../language-reference/keywords/let-clause.md).

> [!NOTE]
> For non-generic data sources such as <xref:System.Collections.ArrayList>, the range variable must be explicitly typed. For more information, see [How to: Query an ArrayList with LINQ (C#)](./how-to-query-an-arraylist-with-linq.md) and [from clause](../../../language-reference/keywords/from-clause.md).
> For non-generic data sources such as <xref:System.Collections.ArrayList>, the range variable must be explicitly typed. For more information, see [How to query an ArrayList with LINQ (C#)](./how-to-query-an-arraylist-with-linq.md) and [from clause](../../../language-reference/keywords/from-clause.md).

## Filtering
Probably the most common query operation is to apply a filter in the form of a Boolean expression. The filter causes the query to return only those elements for which the expression is true. The result is produced by using the `where` clause. The filter in effect specifies which elements to exclude from the source sequence. In the following example, only those `customers` who have an address in London are returned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This section provides examples of basic [!INCLUDE[sqltecxlinq](~/includes/sqltec
|[How to filter on an optional element (C#)](./how-to-filter-on-an-optional-element.md)|Shows how to find nodes in an irregularly shaped tree.|
|[How to find all nodes in a namespace (C#)](./how-to-find-all-nodes-in-a-namespace.md)|Shows how to find all nodes that are in a specific namespace.|
|[How to: Sort Elements (C#)](./how-to-sort-elements.md)|Shows how to write a query that sorts its results.|
|[How to: Sort Elements on Multiple Keys (C#)](./how-to-sort-elements-on-multiple-keys.md)|Shows how to sort on multiple keys.|
|[How to sort elements on multiple keys (C#)](./how-to-sort-elements-on-multiple-keys.md)|Shows how to sort on multiple keys.|
|[How to calculate intermediate values (C#)](./how-to-calculate-intermediate-values.md)|Shows how to use the `Let` clause to calculate intermediate values in a [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query.|
|[How to: Write a Query that Finds Elements Based on Context (C#)](./how-to-write-a-query-that-finds-elements-based-on-context.md)|Shows how to select elements based on other elements in the tree.|
|[How to debug empty query results sets (C#)](./how-to-debug-empty-query-results-sets.md)|Shows the appropriate fix when debugging queries on XML that is in a default namespace.|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ static void Cast()
- [Standard Query Operators Overview (C#)](./standard-query-operators-overview.md)
- [from clause](../../../language-reference/keywords/from-clause.md)
- [LINQ Query Expressions](../../../linq/index.md)
- [How to: Query an ArrayList with LINQ (C#)](./how-to-query-an-arraylist-with-linq.md)
- [How to query an ArrayList with LINQ (C#)](./how-to-query-an-arraylist-with-linq.md)
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ Element operations return a single, specific element from a sequence.

- <xref:System.Linq>
- [Standard Query Operators Overview (C#)](./standard-query-operators-overview.md)
- [How to: Query for the Largest File or Files in a Directory Tree (LINQ) (C#)](./how-to-query-for-the-largest-file-or-files-in-a-directory-tree-linq.md)
- [How to query for the largest file or files in a directory tree (LINQ) (C#)](./how-to-query-for-the-largest-file-or-files-in-a-directory-tree-linq.md)
4 changes: 2 additions & 2 deletions docs/csharp/programming-guide/concepts/linq/filtering-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ foreach (string str in query)
- [Standard Query Operators Overview (C#)](./standard-query-operators-overview.md)
- [where clause](../../../language-reference/keywords/where-clause.md)
- [How to: Dynamically Specify Predicate Filters at Runtime](../../../linq/dynamically-specify-predicate-filters-at-runtime.md)
- [How to: Query An Assembly's Metadata with Reflection (LINQ) (C#)](./how-to-query-an-assembly-s-metadata-with-reflection-linq.md)
- [How to: Query for Files with a Specified Attribute or Name (C#)](./how-to-query-for-files-with-a-specified-attribute-or-name.md)
- [How to query an assembly's metadata with Reflection (LINQ) (C#)](./how-to-query-an-assembly-s-metadata-with-reflection-linq.md)
- [How to query for files with a specified attribute or name (C#)](./how-to-query-for-files-with-a-specified-attribute-or-name.md)
- [How to: Sort or Filter Text Data by Any Word or Field (LINQ) (C#)](./how-to-sort-or-filter-text-data-by-any-word-or-field-linq.md)
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ foreach (var group in query)
- [Standard Query Operators Overview (C#)](./standard-query-operators-overview.md)
- [group clause](../../../language-reference/keywords/group-clause.md)
- [How to: Create a Nested Group](../../../linq/create-a-nested-group.md)
- [How to: Group Files by Extension (LINQ) (C#)](./how-to-group-files-by-extension-linq.md)
- [How to group files by extension (LINQ) (C#)](./how-to-group-files-by-extension-linq.md)
- [How to: Group Query Results](../../../linq/group-query-results.md)
- [How to: Perform a Subquery on a Grouping Operation](../../../linq/perform-a-subquery-on-a-grouping-operation.md)
- [How to: Split a File Into Many Files by Using Groups (LINQ) (C#)](./how-to-split-a-file-into-many-files-by-using-groups-linq.md)
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Find the Root Element (XPath-LINQ to XML) (C#)"
title: "How to find the root element (XPath-LINQ to XML) (C#)"
ms.date: 07/20/2015
ms.assetid: 4fd824e0-4d39-429b-b092-f6a5c046ee6c
---
# How to: Find the Root Element (XPath-LINQ to XML) (C#)
# How to find the root element (XPath-LINQ to XML) (C#)
This topic shows how to get the root element with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The XPath expression is:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Find the Set Difference Between Two Lists (LINQ) (C#)"
title: "How to find the set difference between two lists (LINQ) (C#)"
ms.date: 07/20/2015
ms.assetid: 8e8945f0-4aba-439d-8d5d-c8d1eeef4e71
---
# How to: Find the Set Difference Between Two Lists (LINQ) (C#)
# How to find the set difference between two lists (LINQ) (C#)
This example shows how to use LINQ to compare two lists of strings and output those lines that are in names1.txt but not in names2.txt.

### To create the data files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Generate Text Files from XML (C#)"
title: "How to generate text files from XML (C#)"
ms.date: 07/20/2015
ms.assetid: 9ad283f7-7cac-42ff-bf32-92aa866e6883
---
# How to: Generate Text Files from XML (C#)
# How to generate text files from XML (C#)
This example shows how to generate a comma-separated values (CSV) file from an XML file.

## Example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Generate XML from CSV Files (C#)"
title: "How to generate XML from CSV files (C#)"
ms.date: 07/20/2015
ms.assetid: 57b9ccde-f983-4a21-ae61-70ecede30307
---
# How to: Generate XML from CSV Files (C#)
# How to generate XML from CSV files (C#)
This example shows how to use [!INCLUDE[vbteclinqext](~/includes/vbteclinqext-md.md)] and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to generate an XML file from a comma-separated value (CSV) file.

## Example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Group Files by Extension (LINQ) (C#)"
title: "How to group files by extension (LINQ) (C#)"
ms.date: 07/20/2015
ms.assetid: 21a98320-a5a1-4981-82d8-6a637e7d9018
---
# How to: Group Files by Extension (LINQ) (C#)
# How to group files by extension (LINQ) (C#)
This example shows how LINQ can be used to perform advanced grouping and sorting operations on lists of files or folders. It also shows how to page output in the console window by using the <xref:System.Linq.Enumerable.Skip%2A> and <xref:System.Linq.Enumerable.Take%2A> methods.

## Example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Join Content from Dissimilar Files (LINQ) (C#)"
title: "How to join content from dissimilar files (LINQ) (C#)"
ms.date: 06/27/2018
ms.assetid: aa2d12a6-70a9-492f-a6db-b2b850d46811
---
# How to: Join Content from Dissimilar Files (LINQ) (C#)
# How to join content from dissimilar files (LINQ) (C#)

This example shows how to join data from two comma-delimited files that share a common value that is used as a matching key. This technique can be useful if you have to combine data from two spreadsheets, or from a spreadsheet and from a file that has another format, into a new file. You can modify the example to work with any kind of structured text.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Join Two Collections (LINQ to XML) (C#)"
title: "How to join two collections (LINQ to XML) (C#)"
ms.date: 07/20/2015
ms.assetid: 7b817ede-911a-4cff-9dd3-639c3fc228c9
---
# How to: Join Two Collections (LINQ to XML) (C#)
# How to join two collections (LINQ to XML) (C#)
An element or attribute in an XML document can sometimes refer to another element or attribute. For example, the [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md) XML document contains a list of customers and a list of orders. Each `Customer` element contains a `CustomerID` attribute. Each `Order` element contains a `CustomerID` element. The `CustomerID` element in each order refers to the `CustomerID` attribute in a customer.

The topic [Sample XSD File: Customers and Orders](./sample-xsd-file-customers-and-orders1.md) contains an XSD that can be used to validate this document. It uses the `xs:key` and `xs:keyref` features of XSD to establish that the `CustomerID` attribute of the `Customer` element is a key, and to establish a relationship between the `CustomerID` element in each `Order` element and the `CustomerID` attribute in each `Customer` element.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: List All Nodes in a Tree (C#)"
title: "How to list all nodes in a tree (C#)"
ms.date: 07/20/2015
ms.assetid: 3e934371-f4c6-458b-9f6b-f9061b596f5b
---
# How to: List All Nodes in a Tree (C#)
# How to list all nodes in a tree (C#)
Sometimes it is helpful to list all nodes in a tree. This can be useful when learning exactly how a method or property affects the tree. One approach to listing all nodes in a textual form is to generate an XPath expression that exactly and specifically identifies any node in the tree.

It is not particularly helpful to execute XPath expressions using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. XPath expressions have poorer performance than [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries, and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries are much more powerful. However, as a way to identify nodes in the XML tree, XPath works well.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Load XML from a File (C#)"
title: "How to load XML from a file (C#)"
ms.date: 07/20/2015
ms.assetid: 3ed38487-8028-4209-9872-c8dce0ed4dfe
---
# How to: Load XML from a File (C#)
# How to load XML from a file (C#)
This topic shows how to load XML from a URI by using the <xref:System.Xml.Linq.XElement.Load%2A?displayProperty=nameWithType> method.

## Example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Modify an Office Open XML Document (C#)"
title: "How to modify an Office Open XML document (C#)"
ms.date: 07/20/2015
ms.assetid: 467d489c-2b1b-453b-a757-8ac180e82a96
---
# How to: Modify an Office Open XML Document (C#)
# How to modify an Office Open XML document (C#)
This topic presents an example that opens an Office Open XML document, modifies it, and saves it.

For more information on Office Open XML, see [Open XML SDK](https://github.com/OfficeDev/Open-XML-SDK) and [www.ericwhite.com](http://ericwhite.com/).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Parse a String (C#)"
title: "How to parse a string (C#)"
ms.date: 07/20/2015
ms.assetid: 81e5686c-9658-42d8-a7e3-b11be0a2c98b
---
# How to: Parse a String (C#)
# How to parse a string (C#)

This topic shows how to parse a string to create an XML tree in C#.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Perform Streaming Transform of Large XML Documents (C#)"
title: "How to perform streaming transform of large XML documents (C#)"
ms.date: 07/20/2015
ms.assetid: 5f16d1f8-5370-4b55-b0c8-e497df163037
---
# How to: Perform Streaming Transform of Large XML Documents (C#)
# How to perform streaming transform of large XML documents (C#)
Sometimes you have to transform large XML files, and write your application so that the memory footprint of the application is predictable. If you try to populate an XML tree with a very large XML file, your memory usage will be proportional to the size of the file (that is, excessive). Therefore, you should use a streaming technique instead.

Streaming techniques are best applied in situations where you need to process the source document only once, and you can process the elements in document order. Certain standard query operators, such as <xref:System.Linq.Enumerable.OrderBy%2A>, iterate their source, collect all of the data, sort it, and then finally yield the first item in the sequence. Note that if you use a query operator that materializes its source before yielding the first item, you will not retain a small memory footprint for your application.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "How to: Perform Streaming Transformations of Text to XML (C#)"
title: "How to perform streaming transformations of text to XML (C#)"
ms.date: 07/20/2015
ms.assetid: 9b3bd941-d0ff-4f2d-ae41-7c3b81d8fae6
---
# How to: Perform Streaming Transformations of Text to XML (C#)
# How to perform streaming transformations of text to XML (C#)

One approach to processing a text file is to write an extension method that streams the text file a line at a time using the `yield return` construct. You then can write a LINQ query that processes the text file in a lazy deferred fashion. If you then use <xref:System.Xml.Linq.XStreamingElement> to stream output, you then can create a transformation from the text file to XML that uses a minimal amount of memory, regardless of the size of the source text file.

Expand Down
Loading