It would be nice if there was a dedicated overload for value types, like:
public static T MissingValue<T>(Nullable<T> input, [CallerArgumentExpression("input")] string? parameterName = null)
where T: struct
{
if (!input.HasValue) throw new ArgumentNullException(parameterName);
return input.Value;
}
This way we guarantee that return type has a value.
What do you think? If you agree, I will submit a PR (with the proper format of course and usual behavior).
It would be nice if there was a dedicated overload for value types, like:
This way we guarantee that return type has a value.
What do you think? If you agree, I will submit a PR (with the proper format of course and usual behavior).