Skip to content

Enhanced support for value types #242

@molinch

Description

@molinch

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions