mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-23 00:18:47 +00:00
(#42) Validate count >=0
This commit is contained in:
parent
e8ef1cd028
commit
e3d38a633d
@ -1,4 +1,6 @@
|
||||
namespace X10D
|
||||
using System;
|
||||
|
||||
namespace X10D
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="char" />.
|
||||
@ -15,7 +17,12 @@
|
||||
/// </returns>
|
||||
public static string Repeat(this char value, int count)
|
||||
{
|
||||
return new(value, count);
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(count), ExceptionMessages.CountMustBeGreaterThanOrEqualTo0);
|
||||
}
|
||||
|
||||
return new string(value, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user