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> : IBehaviorResultType Parameters
Section titled “Type Parameters”T
The payload type carried by the result.
Inheritance
Section titled “Inheritance”Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
Section titled “Constructors”Result(BehaviorResultStatus, T?, bool, string?, string?, BehaviorFault?)
Section titled “ Result(BehaviorResultStatus, T?, bool, string?, string?, BehaviorFault?)”Initializes a new instance of the
protected Result(BehaviorResultStatus status, T? value, bool hasValue, string? message, string? code, BehaviorFault? fault)Parameters
Section titled “Parameters”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.
Properties
Section titled “Properties”Gets the stable outcome code when one was supplied.
public string? Code { get; }Property Value
Section titled “Property Value”Gets the structured fault details when the outcome is not successful.
public BehaviorFault? Fault { get; }Property Value
Section titled “Property Value”HasValue
Section titled “ HasValue”Gets a value indicating whether the result carries a payload value.
public bool HasValue { get; }Property Value
Section titled “Property Value”IsSuccess
Section titled “ IsSuccess”Gets a value indicating whether the result represents a successful outcome.
public bool IsSuccess { get; }Property Value
Section titled “Property Value”Message
Section titled “ Message”Gets the human-readable outcome message.
public string Message { get; }Property Value
Section titled “Property Value”Status
Section titled “ Status”Gets the transport-neutral outcome status.
public BehaviorResultStatus Status { get; }Property Value
Section titled “Property Value”Gets the typed payload value when one was supplied.
public T? Value { get; }Property Value
Section titled “Property Value”T?
Methods
Section titled “Methods”GetDefaultMessage(BehaviorResultStatus)
Section titled “ GetDefaultMessage(BehaviorResultStatus)”Resolves the built-in default message for a behavior-result status.
protected static string GetDefaultMessage(BehaviorResultStatus status)Parameters
Section titled “Parameters”status BehaviorResultStatus
The status whose default message should be returned.
Returns
Section titled “Returns”The default message used when callers do not supply one explicitly.
Operators
Section titled “Operators”implicit operator Result<T>(T)
Section titled “ implicit operator Result<T>(T)”Converts a raw payload value into a successful result.
public static implicit operator Result<T>(T value)Parameters
Section titled “Parameters”value T
Returns
Section titled “Returns”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)Parameters
Section titled “Parameters”descriptor BehaviorResultDescriptor
Returns
Section titled “Returns”Result<T>