Class OneOfBase<T1, T2>
- Namespace
- REslava.Result.AdvancedPatterns
- Assembly
- REslava.Result.dll
Shared dispatch base for discriminated unions of two types. Inherited by OneOf<T1, T2> and ErrorsOf<T1, T2>.
public abstract class OneOfBase<T1, T2>
Type Parameters
T1T2
- Inheritance
-
OneOfBase<T1, T2>
- Inherited Members
- Extension Methods
Properties
AsT1
public T1 AsT1 { get; }
Property Value
- T1
AsT2
public T2 AsT2 { get; }
Property Value
- T2
IsT1
public bool IsT1 { get; }
Property Value
IsT2
public bool IsT2 { 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>)
public TResult Match<TResult>(Func<T1, TResult> case1, Func<T2, TResult> case2)
Parameters
Returns
- TResult
Type Parameters
TResult
Switch(Action<T1>, Action<T2>)
public void Switch(Action<T1> case1, Action<T2> case2)
Parameters
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.