mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 23:58:48 +00:00
(#42) Short circuit char.Repeat count 0 and 1
This commit is contained in:
parent
132573e262
commit
25a40521c8
@ -21,7 +21,17 @@ 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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user