Skip to content

M_RailwaySharp_ErrorHandling_ResultExtensions_Either__3

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

ResultExtensions.Either(TSuccess, TMessage, TResult) Method

Allows pattern matching on Results.

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

Syntax

C#

public static TResult Either<TSuccess, TMessage, TResult>(
	this Result<TSuccess, TMessage> result,
	Func<TSuccess, IEnumerable<TMessage>, TResult> ifSuccess,
	Func<IEnumerable<TMessage>, TResult> ifFailure
)

VB

<ExtensionAttribute>
Public Shared Function Either(Of TSuccess, TMessage, TResult) ( 
	result As Result(Of TSuccess, TMessage),
	ifSuccess As Func(Of TSuccess, IEnumerable(Of TMessage), TResult),
	ifFailure As Func(Of IEnumerable(Of TMessage), TResult)
) As TResult

C++

public:
[ExtensionAttribute]
generic<typename TSuccess, typename TMessage, typename TResult>
static TResult Either(
	Result<TSuccess, TMessage>^ result, 
	Func<TSuccess, IEnumerable<TMessage>^, TResult>^ ifSuccess, 
	Func<IEnumerable<TMessage>^, TResult>^ ifFailure
)

F#

[<ExtensionAttribute>]
static member Either : 
        result : Result<'TSuccess, 'TMessage> * 
        ifSuccess : Func<'TSuccess, IEnumerable<'TMessage>, 'TResult> * 
        ifFailure : Func<IEnumerable<'TMessage>, 'TResult> -> 'TResult 

Parameters

 

result
Type: RailwaySharp.ErrorHandling.Result(TSuccess, TMessage)
ifSuccess
Type: System.Func(TSuccess, IEnumerable(TMessage), TResult)
ifFailure
Type: System.Func(IEnumerable(TMessage), TResult)

Type Parameters

 

TSuccess
TMessage
TResult

Return Value

Type: TResult

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Result(TSuccess, TMessage). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also

Reference

ResultExtensions Class
RailwaySharp.ErrorHandling Namespace

Clone this wiki locally