Skip to content

T_RailwaySharp_ErrorHandling_ResultExtensions

Moh.Hassan edited this page Oct 10, 2019 · 1 revision

ResultExtensions Class

Extensions methods for easier usage.

Inheritance Hierarchy

System.Object
  RailwaySharp.ErrorHandling.ResultExtensions
Namespace: RailwaySharp.ErrorHandling
Assembly: CommandLine (in CommandLine.dll) Version: 0.0.0

Syntax

C#

internal static class ResultExtensions

VB

<ExtensionAttribute>
Friend NotInheritable Class ResultExtensions

C++

[ExtensionAttribute]
internal ref class ResultExtensions abstract sealed

F#

[<AbstractClassAttribute>]
[<SealedAttribute>]
[<ExtensionAttribute>]
type ResultExtensions =  class end

The ResultExtensions type exposes the following members.

Methods

 

Name Description
Public methodStatic member Collect(TSuccess, TMessage) Collects a sequence of Results and accumulates their values. If the sequence contains an error the error will be propagated.
Public methodStatic member Either(TSuccess, TMessage, TResult) Allows pattern matching on Results.
Public methodStatic member FailedWith(TSuccess, TMessage) Returns the error messages or fails if the result was a success.
Public methodStatic member Flatten(TSuccess, TMessage) Collects a sequence of Results and accumulates their values. If the sequence contains an error the error will be propagated.
Public methodStatic member Map(TSuccess, TMessage, TResult) Lifts a Func into a Result and applies it on the given result.
Public methodStatic member Match(TSuccess, TMessage) Allows pattern matching on Results.
Public methodStatic member Select(TSuccess, TMessage, TResult) Lifts a Func into a Result and applies it on the given result.
Public methodStatic member SelectMany(TSuccess, TMessage, TResult)(Result(TSuccess, TMessage), Func(TSuccess, Result(TResult, TMessage))) If the result is a Success it executes the given Func on the value. Otherwise the exisiting failure is propagated.
Public methodStatic member SelectMany(TSuccess, TMessage, TValue, TResult)(Result(TSuccess, TMessage), Func(TSuccess, Result(TValue, TMessage)), Func(TSuccess, TValue, TResult)) If the result is a Success it executes the given Func on the value. If the result of the Func is a Success it maps it using the given Func. Otherwise the exisiting failure is propagated.
Public methodStatic member SucceededWith(TSuccess, TMessage) Returns the result or fails if the result was an error.
  Back to Top

See Also

Reference

RailwaySharp.ErrorHandling Namespace

Clone this wiki locally