МР
Size: a a a
МР
МР
МР
Dm
МР
Dm
Dm
Dm
Dm
Dm

Dm
Dm
Dm
Dm
public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source) =>
source.TryGetFirst(out bool _);
public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate) =>
source.TryGetFirst(predicate, out bool _);
private static TSource TryGetFirst<TSource>(this IEnumerable<TSource> source, out bool found)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
}
if (source is IPartition<TSource> partition)
{
return partition.TryGetFirst(out found);
}
if (source is IList<TSource> list)
{
if (list.Count > 0)
{
found = true;
return list[0];
}
}
else
{
using (IEnumerator<TSource> e = source.GetEnumerator())
{
if (e.MoveNext())
{
found = true;
return e.Current;
}
}
}
found = false;
return default(TSource);
}ВГ
Dm
ВГ
ВГ
СЕ
СЕ