diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs
index 8979c897a3..a2448190a5 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs
@@ -253,8 +253,6 @@ public static class Check
return value;
}
-
-
public static Int16 Range(
Int16 value,
[InvokerParameterName][NotNull] string parameterName,
@@ -340,29 +338,21 @@ public static class Check
return value;
}
- ///
- /// Checks if value of type T (struct) is empty, default or null
- ///
- ///
- ///
- ///
- ///
- ///
- public static T NotDefaultorNull(
- Nullable value,
+ public static T NotDefaultOrNull(
+ T? value,
[InvokerParameterName][NotNull] string parameterName)
where T : struct
{
- if (value.Equals(default(T)))
+ if (value == null)
{
- throw new ArgumentException($"{parameterName} has a default value or is empty!", parameterName);
+ throw new ArgumentException($"{parameterName} is null!", parameterName);
}
- else if (value.HasValue == false)
+
+ if (value.Value.Equals(default(T)))
{
- throw new ArgumentException($"{parameterName} is null!", parameterName);
+ throw new ArgumentException($"{parameterName} has a default value!", parameterName);
}
- return (T)value;
+ return value.Value;
}
-
}