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: src/Extensions/ReadOnlySpan/Linq/LastOrDefault.cs
+13-2Lines changed: 13 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -18,8 +18,19 @@ public static T LastOrDefault<T>(this ReadOnlySpan<T> source, T defaultValue)
18
18
returndefaultValue;
19
19
}
20
20
returnsource[^1];
21
+
22
+
/* Unmerged change from project 'SpanExtensions (netstandard2.1)'
23
+
Before:
24
+
}
25
+
26
+
/// <summary>
27
+
After:
28
+
}
29
+
30
+
/// <summary>
31
+
*/
21
32
}
22
-
33
+
23
34
/// <summary>
24
35
/// Returns the last element in a <see cref="ReadOnlySpan{T}"/> that satisfies a specified condition or a specified default value if no such element is found.
25
36
/// </summary>
@@ -93,7 +104,7 @@ public static T LastOrDefault<T>(this ReadOnlySpan<T> source, Predicate<T> predi
93
104
returnitem;
94
105
}
95
106
}
96
-
returndefault(T);
107
+
returndefault(T);
97
108
}
98
109
#elif NETSTANDARD2_1
99
110
#pragma warning disable CS8603// Possible null reference return.
Copy file name to clipboardExpand all lines: src/Extensions/ReadOnlySpan/Linq/SingleOrDefault.cs
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ public static partial class ReadOnlySpanExtensions
9
9
/// </summary>
10
10
/// <typeparam name="T">The type of elements in <paramref name="source"/>.</typeparam>
11
11
/// <param name="source">The <see cref="ReadOnlySpan{T}"/> to return the single element of.</param>
12
+
/// /// <param name="defaultValue">The default value to return if <paramref name="source"/> is empty.</param>
12
13
/// <returns>The single element in <paramref name="source"/>.</returns>
13
14
/// <exception cref="InvalidOperationException"><paramref name="source"/> contains more than one element -or- <paramref name="source"/> is empty.</exception>
0 commit comments