Skip to content

Commit

Permalink
Replace "!" with debug assertion in "Permutations"
Browse files Browse the repository at this point in the history
This adds to commit b31c7fd,
"Replace null-forgiving operator uses with debug assertions (morelinq#890)".
  • Loading branch information
atifaziz committed Jan 12, 2023
1 parent 52f705d commit a53d897
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion MoreLinq/Permutations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,14 @@ public void Reset()
_hasMoreResults = true; // there's always at least one permutation: the original set itself
}

public IList<T> Current => _current!;
public IList<T> Current
{
get
{
Debug.Assert(_current is not null);
return _current;
}
}

object IEnumerator.Current => Current;

Expand Down

0 comments on commit a53d897

Please sign in to comment.