(#42) Validate not-null value

This commit is contained in:
Oliver Booth 2021-06-27 13:14:11 +01:00
parent e3d38a633d
commit 370f2d96f4
1 changed files with 5 additions and 0 deletions

View File

@ -46,6 +46,11 @@ namespace X10D
public static bool Between<T1, T2, T3>(this T1 value, T2 lower, T3 upper)
where T1 : IComparable<T2>, IComparable<T3>
{
if (value is null)
{
throw new ArgumentNullException(nameof(value));
}
return value.CompareTo(lower) > 0 && value.CompareTo(upper) < 0;
}