一款简单易用的基础网络通讯组件库。

TimeoutTokenSource 类

带超时功能的取消令牌管理器。

Definition

命名空间: TouchSocket.Core
程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:4.0.0-beta.143+5fcca7a4e70968794985dc3793adc50531308be6
C#
public sealed class TimeoutTokenSource : DisposableObject
Inheritance
Object    DisposableObject    TimeoutTokenSource

备注

此类继承自DisposableObject,提供了组合超时和用户取消令牌的功能。 能够区分操作是因超时还是用户主动取消而终止,并提供相应的异常处理机制。 适用于需要精确控制超时行为的异步操作场景。

构造函数

TimeoutTokenSource 初始化TimeoutTokenSource类的新实例。

属性

DisposedValue 标识该对象是否已被释放
(继承自 DisposableObject。)
State 获取当前超时令牌源的状态。
Token 获取组合后的取消令牌。

方法

CheckCancellationResult 检查取消结果并转换为适当的结果类型。
Dispose 释放资源。内部已经处理了SuppressFinalize(Object)
(继承自 DisposableObject。)
EqualsDetermines whether the specified object is equal to the current object.
(继承自 Object。)
GetHashCodeServes as the default hash function.
(继承自 Object。)
GetTypeGets the Type of the current instance.
(继承自 Object。)
HandleCancellation 处理操作取消异常,转换为适当的异常类型并更新状态。
MarkCompleted 标记操作成功完成。
ToStringReturns a string that represents the current object.
(继承自 Object。)

扩展方法

Map 将源对象的属性映射到目标对象的属性中。
(由 Mapper 定义。)
Map 将源对象映射到目标类型的实例。
(由 Mapper 定义。)
MapTTarget 将源对象映射到指定目标类型的新实例。
(由 Mapper 定义。)
ToJsonString 转换为Json
(由 SerializeConvert 定义。)

参见