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

This commit is contained in:
John Colvin committed 2025-11-18 11:50:15 -05:00
1 parent c0b7b39091
commit c6a4b91c27
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()) {