Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit 74262e5

Browse files
committed
Use Span<char> for temporary array
1 parent a16a63f commit 74262e5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

UniqueFileGenerator/RandomStringFactory.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,12 @@ public RandomStringFactory(CharacterType charTypes)
6363
public string CreateUniqueString(int length)
6464
{
6565
if (length < 0)
66-
{
67-
throw new ArgumentOutOfRangeException(
68-
nameof(length), Resources.LengthInvalidNegative);
69-
}
66+
throw new ArgumentOutOfRangeException(nameof(length), Resources.LengthInvalidNegative);
7067

7168
if (length == 0)
7269
return string.Empty;
7370

74-
var outputChars = new char[length];
71+
Span<char> outputChars = new char[length];
7572

7673
for (var i = 0; i < outputChars.Length; i++)
7774
{

0 commit comments

Comments
 (0)