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

AsyncQueueT

一个线程安全的、支持异步出队的队列。

Definition

命名空间: TouchSocket.Core
程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:4.0.0-beta.143+5fcca7a4e70968794985dc3793adc50531308be6
C#
public class AsyncQueue<T>
Inheritance
Object    AsyncQueueT

类型参数

T
队列中存储的值的类型。

构造函数

AsyncQueueT 初始化 AsyncQueueT 类的新实例。

属性

Completion 获取一个任务,当调用 Complete 且队列为空时,该任务会转换为完成状态。
Count 获取队列中当前元素的数量。
InitialCapacity 获取队列的初始容量。
IsCompleted 获取一个值,指示队列是否为空且已调用 Complete
IsEmpty 获取一个值,指示队列当前是否为空。
SyncRoot 获取此队列使用的同步对象。

方法

Clear 清空队列中的所有元素。
Complete 表示不再有元素会被入队。
DequeueAsync 获取一个任务,其结果是队列头部的元素。
Enqueue 将一个元素添加到队列的尾部。
EqualsDetermines whether the specified object is equal to the current object.
(继承自 Object。)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(继承自 Object。)
GetHashCodeServes as the default hash function.
(继承自 Object。)
GetTypeGets the Type of the current instance.
(继承自 Object。)
MemberwiseCloneCreates a shallow copy of the current Object.
(继承自 Object。)
OnCompleted 当队列完成时调用。
OnDequeued 当一个值被出队时调用。
OnEnqueued 当一个值被入队时调用。
Peek 获取队列头部的值而不将其从队列中移除。
ToArray 将此队列的副本作为数组返回。
ToStringReturns a string that represents the current object.
(继承自 Object。)
TryDequeue(T) 如果队列头部有可用的元素,则立即将其出队,否则返回而不出队。
TryDequeue(PredicateT, T) 如果队列头部有满足指定检查的可用元素,则立即将其出队; 否则返回而不出队。
TryEnqueue 如果队列尚未完成,则将一个元素添加到队列的尾部。
TryPeek 获取队列头部的值而不将其从队列中移除(如果队列非空)。

扩展方法

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

参见