mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-14 04:35:41 +00:00
(#42) Short circuit char.Repeat count 0 and 1
This commit is contained in:
parent
132573e262
commit
25a40521c8
@ -22,6 +22,16 @@ namespace X10D
|
|||||||
throw new ArgumentOutOfRangeException(nameof(count), ExceptionMessages.CountMustBeGreaterThanOrEqualTo0);
|
throw new ArgumentOutOfRangeException(nameof(count), ExceptionMessages.CountMustBeGreaterThanOrEqualTo0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 1)
|
||||||
|
{
|
||||||
|
return value.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
return new string(value, count);
|
return new string(value, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user