close
Skip to content

Skip null validation on nullable types to prioritize other validations #73

@CesarD

Description

@CesarD

Is there a way to ignore the default null validation on nullable values if I don't care about that but I want to validate that, in case that the value is not null, for example I may want to perform other validation such as IsLongerThan(..) or anything else?

There are cases where I don't want to perform the null validation because that might be a valid value, but if there is actually a value, then I want to make sure it's no longer than a certain length or some other validation.

Example:

string? street = "123 Some Street";
Street = street.Throw().IsLongerThan(100);

Right now this is showing Warnings because string? must match notnull constraint to use it as parameter TValue.

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