Table of Contents

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

TSuccess

The success type.

TFailure

The 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

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

other Result<TSuccess, TFailure>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

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

left Result<TSuccess, TFailure>

The first result.

right Result<TSuccess, TFailure>

The second result.

Returns

bool

true if the results are equal; otherwise, false.

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

left Result<TSuccess, TFailure>

The first result.

right Result<TSuccess, TFailure>

The second result.

Returns

bool

true if the results differ; otherwise, false.