ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
}
- Comparer<TSource> comparer = Comparer<TSource>.Default;
TSource? value = default;
- if (value == null)
+ using (IEnumerator<TSource> e = source.GetEnumerator())
{
- using (IEnumerator<TSource> e = source.GetEnumerator())
+ if (value == null)
{
do
{
}
while (value == null);
+ Comparer<TSource> comparer = Comparer<TSource>.Default;
while (e.MoveNext())
{
TSource x = e.Current;
}
}
}
- }
- else
- {
- using (IEnumerator<TSource> e = source.GetEnumerator())
+ else
{
if (!e.MoveNext())
{
while (e.MoveNext())
{
TSource x = e.Current;
- if (comparer.Compare(x, value) > 0)
+ if (Comparer<TSource>.Default.Compare(x, value) > 0)
{
value = x;
}
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
}
- Comparer<TSource> comparer = Comparer<TSource>.Default;
TSource? value = default;
- if (value == null)
+ using (IEnumerator<TSource> e = source.GetEnumerator())
{
- using (IEnumerator<TSource> e = source.GetEnumerator())
+ if (value == null)
{
do
{
}
while (value == null);
+ Comparer<TSource> comparer = Comparer<TSource>.Default;
while (e.MoveNext())
{
TSource x = e.Current;
}
}
}
- }
- else
- {
- using (IEnumerator<TSource> e = source.GetEnumerator())
+ else
{
if (!e.MoveNext())
{
while (e.MoveNext())
{
TSource x = e.Current;
- if (comparer.Compare(x, value) < 0)
+ if (Comparer<TSource>.Default.Compare(x, value) < 0)
{
value = x;
}