Skip to content

Class Result

Namespace: Cephalon.Abstractions.Behaviors
Assembly: Cephalon.Abstractions.dll

Represents a concise transport-neutral behavior outcome with an optional payload value.

public class Result<T> : IBehaviorResult

T

The payload type carried by the result.

objectResult<T>

IBehaviorResult

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Result(BehaviorResultStatus, T?, bool, string?, string?, BehaviorFault?)

Section titled “ Result(BehaviorResultStatus, T?, bool, string?, string?, BehaviorFault?)”

Initializes a new instance of the class.

protected Result(BehaviorResultStatus status, T? value, bool hasValue, string? message, string? code, BehaviorFault? fault)

status BehaviorResultStatus

The transport-neutral outcome status.

value T?

The optional payload value.

hasValue bool

Whether the result carries a payload value.

message string?

The human-readable outcome message.

code string?

The stable outcome code.

fault BehaviorFault?

The structured fault details.

Gets the stable outcome code when one was supplied.

public string? Code { get; }

string?

Gets the structured fault details when the outcome is not successful.

public BehaviorFault? Fault { get; }

BehaviorFault?

Gets a value indicating whether the result carries a payload value.

public bool HasValue { get; }

bool

Gets a value indicating whether the result represents a successful outcome.

public bool IsSuccess { get; }

bool

Gets the human-readable outcome message.

public string Message { get; }

string

Gets the transport-neutral outcome status.

public BehaviorResultStatus Status { get; }

BehaviorResultStatus

Gets the typed payload value when one was supplied.

public T? Value { get; }

T?

Resolves the built-in default message for a behavior-result status.

protected static string GetDefaultMessage(BehaviorResultStatus status)

status BehaviorResultStatus

The status whose default message should be returned.

string

The default message used when callers do not supply one explicitly.

Converts a raw payload value into a successful result.

public static implicit operator Result<T>(T value)

value T

Result<T>

implicit operator Result<T>(BehaviorResultDescriptor)

Section titled “ implicit operator Result<T>(BehaviorResultDescriptor)”

Converts a no-payload descriptor into a typed result.

public static implicit operator Result<T>(BehaviorResultDescriptor descriptor)

descriptor BehaviorResultDescriptor

Result<T>