Open sandboxFocus

Method ToNonNullable

ToNonNullable()

Returns the non-nullable type from the current IType. If the current type is a non-nullable reference type, returns the current type. If the current type is a Nullable<T>, i.e. a nullable value type, returns the underlying type.

Declaration
IType ToNonNullable()
Returns
Type Description
IType
Remarks

For type parameters without a class or struct constraint, this method always strips the nullable annotation because C# has no way to express non-nullability for such type parameters. To unconditionally strip nullability annotations for all types, use StripNullabilityAnnotation() instead.

For nullable value types, i.e. Nullable<T>, this method returns the underlying type T.

See Also