You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: xml/System.Linq/Queryable.xml
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -8335,8 +8335,8 @@ If `count` is not a positive number, this method returns an empty queryable sequ
8335
8335
## Examples
8336
8336
The following code example demonstrates how to use <xref:System.Linq.Queryable.Union%60%601%28System.Linq.IQueryable%7B%60%600%7D%2CSystem.Collections.Generic.IEnumerable%7B%60%600%7D%29> to obtain the set union of two sequences.
Copy file name to clipboardExpand all lines: xml/System.Text/Encoder.xml
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -73,9 +73,9 @@
73
73
## Examples
74
74
The following example demonstrates how to convert an array of Unicode characters into blocks of bytes using a specified encoding. For comparison, the array of characters is first encoded using <xref:System.Text.UTF7Encoding>. Next, the array of characters is encoded using an <xref:System.Text.Encoder>.
Copy file name to clipboardExpand all lines: xml/System.Text/UTF8Encoding.xml
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1936,14 +1936,14 @@
1936
1936
## Examples
1937
1937
The following example uses the <xref:System.Text.UTF8Encoding.GetPreamble%2A> method to return the Unicode byte order mark encoded in UTF-8 format. Notice that the parameterless constructor for <xref:System.Text.UTF8Encoding> does not provide a preamble.
The following example instantiates two <xref:System.Text.UTF8Encoding> objects, the first by calling the parameterless <xref:System.Text.UTF8Encoding.%23ctor> constructor, which does not provide a BOM, and the second by calling the <xref:System.Text.UTF8Encoding.%23ctor%28System.Boolean%29> constructor with its `encoderShouldEmitUTF8Identifier` argument set to `true`. It then calls the <xref:System.Text.UTF8Encoding.GetPreamble%2A> method to write the BOM to a file before writing a UF8-encoded string. As the console output from the example shows, the file that saves the bytes from the second encoder has three more bytes than the first.
You can also compare the files by using the `fc` command in a console window, or you can inspect the files in a text editor that includes a Hex View mode. Note that when the file is opened in an editor that supports UTF-8, the BOM is not displayed.
Copy file name to clipboardExpand all lines: xml/System/ArgumentOutOfRangeException.xml
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -78,8 +78,8 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i
78
78
79
79
1. The collection has no members, and your code assumes that it does. The following example attempts to retrieve the first element of a collection that has no elements:
To prevent the exception, check whether the collection's `Count` property is greater than zero before attempting to retrieve any members, as the following code fragment does.
85
85
@@ -98,8 +98,8 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i
98
98
99
99
3. You're attempting to retrieve an item whose index is negative. This usually occurs because you've searched a collection for the index of a particular element and have erroneously assumed that the search is successful. In the following example, the call to the <xref:System.Collections.Generic.List%601.FindIndex%28System.Predicate%7B%600%7D%29?displayProperty=nameWithType> method fails to find a string equal to "Z" and so returns -1. However, this is an invalid index value.
To prevent the exception, check that the search is successful by making sure that the returned index is greater than or equal to zero before attempting to retrieve the item from the collection, as the following code fragment does.
105
105
@@ -108,8 +108,8 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i
108
108
109
109
4. You're attempting to retrieve an element whose index is equal to the value of the collection's `Count` property, as the following example illustrates.
Because collections in .NET use zero-based indexing, the first element of the collection is at index 0, and the last element is at index `Count` - 1. You can eliminate the error by ensuring that you access the last element at index `Count` - 1, as the following code does.
115
115
@@ -141,8 +141,8 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i
141
141
142
142
To eliminate the exception, validate the value returned by the string search method before calling the string manipulation method.
3. You've attempted to extract a substring that is outside the range of the current string.
148
148
@@ -164,8 +164,8 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i
164
164
165
165
The following example defines a `FindWords` method that uses the <xref:System.String.IndexOfAny%28System.Char%5B%5D%2CSystem.Int32%29?displayProperty=nameWithType> method to identify space characters and punctuation marks in a string and returns an array that contains the words found in the string.
- You have passed a negative number to a method with an argument that requires only positive numbers and zero, or you have passed either a negative number or zero to a method with an argument that requires only positive numbers.
171
171
@@ -216,8 +216,8 @@ For a list of initial property values for an instance of <xref:System.ArgumentOu
216
216
217
217
The following example defines a class to contain information about an invited guest. If the guest is younger than 21, an <xref:System.ArgumentOutOfRangeException> exception is thrown.
Alternately, instead of iterating all the elements in the array by their index, you can use the `foreach` statement (in C#) or the `For Each` statement (in Visual Basic).
75
75
@@ -118,8 +118,8 @@
118
118
119
119
To correct the error, as the following example does, you can call the <xref:System.Array.GetLowerBound%2A> method instead of making assumptions about the starting index of an array.
Note that when you call the <xref:System.Array.GetLowerBound%2A> method to get the starting index of an array, you should also call the <xref:System.Array.GetUpperBound%28System.Int32%29?displayProperty=nameWithType> method to get its ending index.
125
125
@@ -130,8 +130,8 @@
130
130
131
131
The iteration construct returns each value in an array or collection, not its index. To eliminate the exception, use this code.
Copy file name to clipboardExpand all lines: xml/System/Type.xml
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -11866,9 +11866,9 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance
11866
11866
11867
11867
The following code example and table illustrate some of these terms and invariants. The `Derived` class is of particular interest because its base type is a constructed type that has a mixture of types and type parameters in its type argument list.
The following table shows examples that use and build on the classes `Base`, `Derived`, and `G`. When the C++ and C# code is the same, only one entry is shown.
11874
11874
@@ -11886,9 +11886,9 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance
11886
11886
## Examples
11887
11887
The following code example displays the value of the <xref:System.Type.IsGenericType%2A>, <xref:System.Type.IsGenericTypeDefinition%2A>, <xref:System.Type.IsGenericParameter%2A>, and <xref:System.Type.ContainsGenericParameters%2A> properties for the types described in the Remarks section. For explanations of the property values, see the accompanying table in Remarks.
0 commit comments