Struct Result
Implements
Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Color_Chan.Discord.Core.Results
Assembly: Color-Chan.Discord.Core.dll
Syntax
public readonly struct Result : IResult
Properties
| Improve this Doc View SourceErrorResult
The error of the IResult.
Declaration
public readonly IErrorResult ErrorResult { get; }
Property Value
Type | Description |
---|---|
IErrorResult |
Remarks
Null if the result doesn't have an inner result.
InnerResult
The inner IResult.
Declaration
public readonly IResult InnerResult { get; }
Property Value
Type | Description |
---|---|
IResult |
Remarks
| Improve this Doc View SourceIsSuccessful
Whether or not the IResult is successful.
Declaration
public readonly bool IsSuccessful { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceFromError(IErrorResult)
Initializes a new unsuccessful instance of Result.
Declaration
public static Result FromError(IErrorResult errorResult)
Parameters
Type | Name | Description |
---|---|---|
IErrorResult | errorResult | The IErrorResult containing the error details. |
Returns
Type | Description |
---|---|
Result | The unsuccessful instance of Result. |
FromError(IErrorResult, IResult)
Initializes a new unsuccessful instance of Result.
Declaration
public static Result FromError(IErrorResult errorResult, IResult innerResult)
Parameters
Type | Name | Description |
---|---|---|
IErrorResult | errorResult | The IErrorResult containing the error details. |
IResult | innerResult | The inner IResult. |
Returns
Type | Description |
---|---|
Result | The unsuccessful instance of Result. |
FromSuccess()
Initializes a new successful instance of Result.
Declaration
public static Result FromSuccess()
Returns
Type | Description |
---|---|
Result | The successful instance of Result. |
Operators
| Improve this Doc View SourceImplicit(ErrorResult to Result)
Creates a Result from an ErrorResult.
Declaration
public static implicit operator Result(ErrorResult error)
Parameters
Type | Name | Description |
---|---|---|
ErrorResult | error | The ErrorResult. |
Returns
Type | Description |
---|---|
Result | The unsuccessful instance of Result. |
Implicit(Exception to Result)
Declaration
public static implicit operator Result(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | The Exception. |
Returns
Type | Description |
---|---|
Result | The unsuccessful instance of Result. |