Skip to content

T_CSharpx_Either

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

Either Class

Inheritance Hierarchy

System.Object
  CSharpx.Either
Namespace: CSharpx
Assembly: CommandLine (in CommandLine.dll) Version: 0.0.0

Syntax

C#

internal static class Either

VB

<ExtensionAttribute>
Friend NotInheritable Class Either

C++

[ExtensionAttribute]
internal ref class Either abstract sealed

F#

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

The Either type exposes the following members.

Methods

 

Name Description
Public method Static member Bimap(TLeft, TRight, TLeft1, TRight1) Maps both parts of a Either type. Applies the first function if Either is Left. Otherwise applies the second function.
Public method Static member Bind(TLeft, TRight, TResult) Monadic bind.
Public method Static member Cast(TRight) Attempts to cast an object. Stores the cast value in 1Of2 if successful, otherwise stores the exception in 2Of2
Public method Static member Fail(TRight) Fail with a message. Not part of mathematical definition of a monad.
Private method Static member GetLeft(TLeft, TRight)
Public method Static member GetLeftOrDefault(TLeft, TRight) Returns a Either Left or a defualt value.
Public method Static member GetOrFail(TLeft, TRight) Returns a Either Right or fail with an exception.
Public method Static member GetRightOrDefault(TLeft, TRight) Returns a Either Right or a defualt value.
Public method Static member Left(TLeft, TRight)
Public method Static member Map(TLeft, TRight, TResult) Transforms a Either's right value by using a specified mapping function.
Public method Static member OfMaybe(TLeft, TRight)
Public method Static member Return(TRight) Inject a value into the Either type, returning Right case.
Public method Static member Right(TLeft, TRight)
Public method Static member Select(TLeft, TRight, TResult) Map operation compatible with Linq.
Public method Static member SelectMany(TLeft, TRight, TResult)
Public method Static member Try(TRight) Wraps a function, encapsulates any exception thrown within to a Either.
  Back to Top

See Also

Reference

CSharpx Namespace

Clone this wiki locally