Struct Result<TSuccess, TFailure>
- Namespace
- ZeroC.Slice
- Assembly
- ZeroC.Slice.Codec.dll
A union that represents either a success or a failure. It is typically used as the return type of Slice operations.
public readonly struct Result<TSuccess, TFailure> : IEquatable<Result<TSuccess, TFailure>>, IUnion
Type Parameters
TSuccessThe success type.
TFailureThe failure type.
- Implements
-
IEquatable<Result<TSuccess, TFailure>>
- Inherited Members
Remarks
The Slice Result type (a built-in generic type) maps to this generic union in C#. Its cases are Success<T> and Failure<T>.
Methods
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
Equals(Result<TSuccess, TFailure>)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Result<TSuccess, TFailure> other)
Parameters
otherResult<TSuccess, TFailure>An object to compare with this object.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(Result<TSuccess, TFailure>, Result<TSuccess, TFailure>)
Checks if two results are equal.
public static bool operator ==(Result<TSuccess, TFailure> left, Result<TSuccess, TFailure> right)
Parameters
leftResult<TSuccess, TFailure>The first result.
rightResult<TSuccess, TFailure>The second result.
Returns
operator !=(Result<TSuccess, TFailure>, Result<TSuccess, TFailure>)
Checks if two results are not equal.
public static bool operator !=(Result<TSuccess, TFailure> left, Result<TSuccess, TFailure> right)
Parameters
leftResult<TSuccess, TFailure>The first result.
rightResult<TSuccess, TFailure>The second result.