refactor: Drop null type modifier in TryGetFirst ext

Replace w/ MaybeNullWhen attributes
This commit is contained in:
John Colvin committed 2025-11-15 12:45:07 -05:00
1 parent 5d9d364de3
commit 659eb83f4d
1 file changed
+2 -2
@@ -414,7 +414,7 @@ namespace System.Collections.Generic {
}
public static bool TryGetFirst<T>(
this IEnumerable<T> source, Func<T?, bool> predicate, [MaybeNullWhen(false)]out T result) {
this IEnumerable<T> source, Func<T, bool> predicate, [MaybeNullWhen(false)] out T result) {
if (source == null) throw new ArgumentNullException(nameof(source));
foreach (T element in source)
if (predicate(element)) {
@@ -445,7 +445,7 @@ namespace System.Collections.Generic {
}
public static bool TryGetFirst<T>(
this IEnumerable<T> source, Func<T, bool> predicate, out T? result, out int index) {
this IEnumerable<T> source, Func<T, bool> predicate, [MaybeNullWhen(false)]out T result, out int index) {
if (source == null) throw new ArgumentNullException(nameof(source));
index = 0;
foreach (T element in source) {