Skip to content

Commit

Permalink
Merge 2a19ec1 into d684bf8
Browse files Browse the repository at this point in the history
  • Loading branch information
atifaziz authored Nov 4, 2022
2 parents d684bf8 + 2a19ec1 commit 4889b54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
10 changes: 3 additions & 7 deletions MoreLinq.Test/TraceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,9 @@ public void TraceSequenceWithFormatter()

static IEnumerable<string> Lines(string str)
{
using (var e = _(string.IsNullOrEmpty(str)
? TextReader.Null
: new StringReader(str)))
{
while (e.MoveNext())
yield return e.Current;
}
using var e = _(string.IsNullOrEmpty(str) ? TextReader.Null : new StringReader(str));
while (e.MoveNext())
yield return e.Current;

IEnumerator<string> _(TextReader reader)
{
Expand Down
10 changes: 3 additions & 7 deletions MoreLinq/MoreEnumerable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ static int CountUpTo<T>(this IEnumerable<T> source, int max)

var count = 0;

using (var e = source.GetEnumerator())
{
while (count < max && e.MoveNext())
{
count++;
}
}
using var e = source.GetEnumerator();
while (count < max && e.MoveNext())
count++;

return count;
}
Expand Down

0 comments on commit 4889b54

Please sign in to comment.