Skip to content

Add extension versions of UpCast and DownCast #868

@FreeApophis

Description

@FreeApophis

Just had an example where I replaced Wheres and Selects with a DownCast, but it is awkward, because the solution before was fluent, and now it is mixed.

        CannotReadRemoteService = DownCast<ServerIniUpdateSection.Exists>.From(_source.LeftOrNone())
            .Select(s => s.IsServiceOnOtherMachine)
            .GetOrElse(false);

An extension version probably would look like this:

        CannotReadRemoteService = _source
            .LeftOrNone()
            .DownCast<ServerIniUpdateSection.Exists>()
            .Select(s => s.IsServiceOnOtherMachine)
            .GetOrElse(false);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions