Class OneOfBase<T1, T2, T3, T4>
- Namespace
- REslava.Result.AdvancedPatterns
- Assembly
- REslava.Result.dll
Shared dispatch base for discriminated unions of four types.
public abstract class OneOfBase<T1, T2, T3, T4>
Type Parameters
T1T2T3T4
- Inheritance
-
OneOfBase<T1, T2, T3, T4>
- Derived
- Inherited Members
- Extension Methods
Properties
AsT1
public T1 AsT1 { get; }
Property Value
- T1
AsT2
public T2 AsT2 { get; }
Property Value
- T2
AsT3
public T3 AsT3 { get; }
Property Value
- T3
AsT4
public T4 AsT4 { get; }
Property Value
- T4
IsT1
public bool IsT1 { get; }
Property Value
IsT2
public bool IsT2 { get; }
Property Value
IsT3
public bool IsT3 { get; }
Property Value
IsT4
public bool IsT4 { get; }
Property Value
Methods
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
Match<TResult>(Func<T1, TResult>, Func<T2, TResult>, Func<T3, TResult>, Func<T4, TResult>)
public TResult Match<TResult>(Func<T1, TResult> case1, Func<T2, TResult> case2, Func<T3, TResult> case3, Func<T4, TResult> case4)
Parameters
Returns
- TResult
Type Parameters
TResult
Switch(Action<T1>, Action<T2>, Action<T3>, Action<T4>)
public void Switch(Action<T1> case1, Action<T2> case2, Action<T3> case3, Action<T4> case4)
Parameters
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.