1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 03:45:41 +00:00

(#42) Short circuit char.Repeat count 0 and 1

This commit is contained in:
Oliver Booth 2021-07-20 01:02:02 +01:00
parent 132573e262
commit 25a40521c8
No known key found for this signature in database
GPG Key ID: A4AC17007530E9B4

View File

@ -22,6 +22,16 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(count), ExceptionMessages.CountMustBeGreaterThanOrEqualTo0);
}
if (count == 0)
{
return string.Empty;
}
if (count == 1)
{
return value.ToString();
}
return new string(value, count);
}
}