Skip to content

T_CSharpx_Maybe_1

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

Maybe(T) Class

The Maybe type models an optional value. A value of type Maybe a either contains a value of type a (represented as Just a), or it is empty (represented as Nothing).

Inheritance Hierarchy

System.Object
  CSharpx.Maybe(T)
    CSharpx.Just(T)
    CSharpx.Nothing(T)
Namespace: CSharpx
Assembly: CommandLine (in CommandLine.dll) Version: 0.0.0

Syntax

C#

internal abstract class Maybe<T>

VB

Friend MustInherit Class Maybe(Of T)

C++

generic<typename T>
internal ref class Maybe abstract

F#

[<AbstractClassAttribute>]
type Maybe<'T> =  class end

Type Parameters

 

T
  The Maybe(T) type exposes the following members.

Constructors

 

Name Description
Protected method Maybe(T) Initializes a new instance of the Maybe(T) class
  Back to Top

Properties

 

Name Description
Public property Tag Type discriminator.
  Back to Top

Methods

 

Name Description
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method MatchJust Matches a value returning true and value itself via output parameter.
Public method MatchNothing Matches an empty value returning true.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
  Back to Top

Extension Methods

 

Name Description
Public Extension Method Bind(T1, T2) Invokes a function on this maybe value that itself yields a maybe. (Defined by MaybeExtensions.)
Public Extension Method Do(T) If contans a value executes an Action(T) delegate over it. (Defined by MaybeExtensions.)
Public Extension Method FromJust(T) Extracts the element out of a Just(T) and returns a default value if its argument is Nothing(T). (Defined by MaybeExtensions.)
Public Extension Method FromJustOrFail(T) Extracts the element out of a Just(T) and throws an error if its argument is Nothing(T). (Defined by MaybeExtensions.)
Public Extension Method GetValueOrDefault(T) If contains a values returns it, otherwise returns noneValue. (Defined by MaybeExtensions.)
Private Extension Method IsEmpty (Defined by UnParserExtensions.)
Public Extension Method IsJust(T) Returns true iffits argument is of the form Just(T). (Defined by MaybeExtensions.)
Public Extension Method IsNothing(T) Returns true iffits argument is of the form Nothing(T). (Defined by MaybeExtensions.)
Public Extension Method Map(T1, T2) Transforms this maybe value by using a specified mapping function. (Defined by MaybeExtensions.)
Public Extension Method MapValueOrDefault(T1, T2) If contains a values executes a mapping function over it, otherwise returns noneValue. (Defined by MaybeExtensions.)
Public Extension Method Match(T) Provides pattern matching using Action delegates. (Defined by MaybeExtensions.)
Private Extension Method NormalizeValue (Defined by UnParserExtensions.)
Public Extension Method Select(TSource, TResult) Map operation compatible with Linq. (Defined by MaybeExtensions.)
Public Extension Method SelectMany(TSource, TValue, TResult) Bind operation compatible with Linq. (Defined by MaybeExtensions.)
Public Extension Method ToEnumerable(T) Returns an empty list when given Nothing(T) or a singleton list when given a Just(T). (Defined by MaybeExtensions.)
  Back to Top

See Also

Reference

CSharpx Namespace

Clone this wiki locally