Skip to content

Add ValueOrDefault method overload, with Func<T> as argument #169

@stefan-lindegger

Description

@stefan-lindegger

Currently, Maybe.ValueOrDefault offers only a method with a parameter of type T as a method argument.
If this value T is generated via a create method, T is generated before the "None" check is performed. As a consequence, T is created even if Maybe is not “None”.
The aim is to prevent the function from being executed in the method argument in the non-"None" case.
Therefore Maybe.ValueOrDefault shall be extended by a method overload that accepts Func instead of argument T.
This function should only be executed after the "None" check and only in the "None" case.
Method overloads shall be implemented for Maybe and MaybeStruct.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions