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/Enumerable.xml
+25-24Lines changed: 25 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -2179,9 +2179,9 @@ Dim doubles = From item As Integer In sequence
2179
2179
2180
2180
## Examples
2181
2181
The following code example demonstrates how to use <xref:System.Linq.Enumerable.Contains%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%2C%60%600%29> to determine whether an array contains a specific element.
@@ -9331,14 +9331,14 @@ Only unique elements are returned.
9331
9331
9332
9332
## Examples
9333
9333
The following code example demonstrates how to use <xref:System.Linq.Enumerable.Single%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%29> to select the only element of an array.
The following code example demonstrates that <xref:System.Linq.Enumerable.Single%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%29> throws an exception when the sequence does not contain exactly one element.
@@ -9405,14 +9405,15 @@ Only unique elements are returned.
9405
9405
9406
9406
## Examples
9407
9407
The following code example demonstrates how to use <xref:System.Linq.Enumerable.Single%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%2CSystem.Func%7B%60%600%2CSystem.Boolean%7D%29> to select the only element of an array that satisfies a condition.
The following code example demonstrates that <xref:System.Linq.Enumerable.Single%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%2CSystem.Func%7B%60%600%2CSystem.Boolean%7D%29> throws an exception when the sequence does not contain exactly one element that satisfies the condition.
@@ -9495,18 +9496,18 @@ Only unique elements are returned.
9495
9496
## Examples
9496
9497
The following code example demonstrates how to use <xref:System.Linq.Enumerable.SingleOrDefault%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%29> to select the only element of an array.
The following code example demonstrates that <xref:System.Linq.Enumerable.SingleOrDefault%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%29> returns a default value when the sequence does not contain exactly one element.
Sometimes the value of `default(TSource)` is not the default value that you want to use if the collection contains no elements. Instead of checking the result for the unwanted default value and then changing it if necessary, you can use the <xref:System.Linq.Enumerable.DefaultIfEmpty%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%2C%60%600%29> method to specify the default value that you want to use if the collection is empty. Then, call <xref:System.Linq.Enumerable.Single%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%29> to obtain the element. The following code example uses both techniques to obtain a default value of 1 if a collection of page numbers is empty. Because the default value for an integer is 0, which is not usually a valid page number, the default value must be specified as 1 instead. The first result variable is checked for the unwanted default value after the query has finished executing. The second result variable is obtained by using <xref:System.Linq.Enumerable.DefaultIfEmpty%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%2C%60%600%29> to specify a default value of 1.
@@ -9569,9 +9570,9 @@ Only unique elements are returned.
9569
9570
9570
9571
## Examples
9571
9572
The following code example demonstrates how to use <xref:System.Linq.Enumerable.SingleOrDefault%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%2CSystem.Func%7B%60%600%2CSystem.Boolean%7D%29> to select the only element of an array that satisfies a condition.
The following code example demonstrates that <xref:System.Linq.Enumerable.SingleOrDefault%60%601%28System.Collections.Generic.IEnumerable%7B%60%600%7D%2CSystem.Func%7B%60%600%2CSystem.Boolean%7D%29> returns a default value when the sequence does not contain exactly one element that satisfies the condition.
Copy file name to clipboardExpand all lines: xml/System/Object.xml
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -780,17 +780,17 @@ and the <xref:System.IDisposable> interface. The <xref:System.IDisposable.Dispos
780
780
- Delegates, which are derived from <xref:System.MulticastDelegate?displayProperty=nameWithType>.
781
781
782
782
For two objects `x` and `y` that have identical runtime types, `Object.ReferenceEquals(x.GetType(),y.GetType())` returns `true`. The following example uses the <xref:System.Object.GetType%2A> method with the <xref:System.Object.ReferenceEquals%2A> method to determine whether one numeric value is the same type as two other numeric values.
> To determine whether an object is a specific type, you can use your language's type comparison keyword or construct. For example, you can use the `TypeOf…Is` construct in Visual Basic or the `is` keyword in C#.
789
789
790
790
The <xref:System.Object.GetType%2A> method is inherited by all types that derive from <xref:System.Object>. This means that, in addition to using your own language's comparison keyword, you can use the <xref:System.Object.GetType%2A> method to determine the type of a particular object, as the following example shows.
0 commit comments