refactor: Add MaybeNullWhen(false) attr to TryGetSingle ext fn

This commit is contained in:
John Colvin committed 2025-11-19 14:53:04 -05:00
1 parent 1a09e560c5
commit c95e27e4c0
1 file changed
+1 -1
@@ -571,7 +571,7 @@ namespace System.Collections.Generic {
return true;
}
public static bool TryGetSingle<T>(this IEnumerable<T> source, out T? result) {
public static bool TryGetSingle<T>(this IEnumerable<T> source, [MaybeNullWhen(false)]out T result) {
if (source == null) throw new ArgumentNullException(nameof(source));
using (var en = source.GetEnumerator()) {
if (en.MoveNext()) {