1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-14 04:35:41 +00:00

(#27) Move bounds exception to resource

This commit is contained in:
Oliver Booth 2021-04-02 12:40:55 +01:00
parent b36638d4df
commit c6f550d5a7
3 changed files with 15 additions and 1 deletions

View File

@ -79,7 +79,9 @@ namespace X10D.ComparableExtensions
{ {
if (lower.GreaterThan(upper)) 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); return value.Max(lower).Min(upper);

View File

@ -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> /// <summary>
/// Looks up a localized string similar to maxValue must be greater than or equal to 0. /// Looks up a localized string similar to maxValue must be greater than or equal to 0.
/// </summary> /// </summary>

View File

@ -53,4 +53,7 @@
<data name="MaxValueGreaterThanEqualToMinValue" xml:space="preserve"> <data name="MaxValueGreaterThanEqualToMinValue" xml:space="preserve">
<value>maxValue must be greater than or equal to minValue</value> <value>maxValue must be greater than or equal to minValue</value>
</data> </data>
<data name="LowerCannotBeGreaterThanUpper" xml:space="preserve">
<value>{0} cannot be greater than {1}</value>
</data>
</root> </root>