From a53d8973e6c54ac81d251373dc71b0616e258a6f Mon Sep 17 00:00:00 2001 From: Atif Aziz Date: Thu, 12 Jan 2023 21:50:19 +0100 Subject: [PATCH] Replace "!" with debug assertion in "Permutations" This adds to commit b31c7fdd6b02a77f37e57c0684e6bdcb8b51e5ba, "Replace null-forgiving operator uses with debug assertions (#890)". --- MoreLinq/Permutations.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MoreLinq/Permutations.cs b/MoreLinq/Permutations.cs index b700e46fc..fd9698468 100644 --- a/MoreLinq/Permutations.cs +++ b/MoreLinq/Permutations.cs @@ -103,7 +103,14 @@ public void Reset() _hasMoreResults = true; // there's always at least one permutation: the original set itself } - public IList Current => _current!; + public IList Current + { + get + { + Debug.Assert(_current is not null); + return _current; + } + } object IEnumerator.Current => Current;