Class Union<A, B>
Defines a type which is a union of two types.
public abstract class Union<A, B>
Type Parameters
A
B
- Inheritance
-
Union<A, B>
- Derived
- Inherited Members
Methods
Match(Action<A>, Action<B>)
Take an action for the item of the given type.
public abstract void Match(Action<A> first, Action<B> second)
Parameters
Match<TResult>(Func<A, TResult>, Func<B, TResult>)
Run a func against the item of the given type.
public abstract TResult Match<TResult>(Func<A, TResult> first, Func<B, TResult> second)
Parameters
Returns
- TResult
Type Parameters
TResult
One(A)
Create a value of the first type.
public static Union<A, B>.Case1 One(A item)
Parameters
item
A
Returns
TryGetFirst(out A)
Get the item if it is of the specific type.
public abstract bool TryGetFirst(out A a)
Parameters
a
A
Returns
TryGetSecond(out B)
Get the item if it is of the specific type.
public abstract bool TryGetSecond(out B b)
Parameters
b
B
Returns
Two(B)
Create a value of the second type.
public static Union<A, B>.Case2 Two(B item)
Parameters
item
B