Table of Contents

Struct TypeConverterResult

Namespace
HeyBox.Interactions
Assembly
HeyBox.Net.Interactions.dll
public struct TypeConverterResult : IResult
Implements
Inherited Members

Properties

Error

获取操作过程中可能发生的错误类型。

public readonly InteractionCommandError? Error { get; }

Property Value

InteractionCommandError?

一个 InteractionCommandError,指示操作过程中可能发生的错误类型; 如果操作成功,则为 null

ErrorReason

获取错误原因。

public readonly string? ErrorReason { get; }

Property Value

string

包含错误原因的字符串。

IsSuccess

指示操作是否成功。

public bool IsSuccess { get; }

Property Value

bool

如果结果为正,则为 true;否则为 false

Value

如果操作成功,获取转换的结果。

public readonly object? Value { get; }

Property Value

object

Methods

FromError(IResult)

返回一个带有指定 result 类型的 PreconditionResult

public static TypeConverterResult FromError(IResult result)

Parameters

result IResult

失败的结果。

Returns

TypeConverterResult

FromError(InteractionCommandError, string)

返回一个带有指定错误和原因的 PreconditionResult

public static TypeConverterResult FromError(InteractionCommandError error, string reason)

Parameters

error InteractionCommandError

错误类型。

reason string

失败原因。

Returns

TypeConverterResult

FromError(Exception)

返回一个带有 ExceptionMessageTypeConverterResult

public static TypeConverterResult FromError(Exception exception)

Parameters

exception Exception

导致类型转换失败的异常。

Returns

TypeConverterResult

FromSuccess(object?)

返回一个无错误的 TypeConverterResult

public static TypeConverterResult FromSuccess(object? value)

Parameters

value object

Returns

TypeConverterResult

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.