mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-09 23:45:42 +00:00
(#27) Move bounds exception to resource
This commit is contained in:
parent
b36638d4df
commit
c6f550d5a7
@ -79,7 +79,9 @@ namespace X10D.ComparableExtensions
|
||||
{
|
||||
if (lower.GreaterThan(upper))
|
||||
{
|
||||
throw new ArgumentException($@"{lower} cannot be greater than {upper}", nameof(lower));
|
||||
throw new ArgumentException(
|
||||
string.Format(ExceptionMessages.LowerCannotBeGreaterThanUpper, lower, upper),
|
||||
nameof(lower));
|
||||
}
|
||||
|
||||
return value.Max(lower).Min(upper);
|
||||
|
9
X10D/src/ExceptionMessages.Designer.cs
generated
9
X10D/src/ExceptionMessages.Designer.cs
generated
@ -87,6 +87,15 @@ namespace X10D {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} cannot be greater than {1}.
|
||||
/// </summary>
|
||||
internal static string LowerCannotBeGreaterThanUpper {
|
||||
get {
|
||||
return ResourceManager.GetString("LowerCannotBeGreaterThanUpper", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to maxValue must be greater than or equal to 0.
|
||||
/// </summary>
|
||||
|
@ -53,4 +53,7 @@
|
||||
<data name="MaxValueGreaterThanEqualToMinValue" xml:space="preserve">
|
||||
<value>maxValue must be greater than or equal to minValue</value>
|
||||
</data>
|
||||
<data name="LowerCannotBeGreaterThanUpper" xml:space="preserve">
|
||||
<value>{0} cannot be greater than {1}</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user