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

IClientCollectionTClient 接口

客户端集合类

Definition

命名空间: TouchSocket.Sockets
程序集: TouchSocket (在 TouchSocket.dll 中) 版本:3.0.0+ccaf96084d09f972257496d1dd63b8ba3c1e44f0
C#
public interface IClientCollection<TClient> : IEnumerable<TClient>, 
	IEnumerable
where TClient : IIdClient
Implements
IEnumerableTClient, IEnumerable

类型参数

TClient
客户端类型参数,必须实现IIdClient接口

属性

Count 集合中客户端的数量
Item 通过客户端的唯一标识符(Id)获取客户端对象。如果找不到对应的客户端,应返回null。

方法

ClientExist 判断指定Id的客户端是否存在于集合中
GetEnumeratorReturns an enumerator that iterates through the collection.
(继承自 IEnumerableTClient。)
GetIds 获取集合中所有客户端的唯一标识符(Id)
TryGetClient 尝试获取指定Id的客户端对象

扩展方法

ForEachTClient 循环遍历每个元素,执行Action动作
(由 CollectionsExtension 定义。)
ForEachAsyncTClient 循环遍历每个元素,执行异步动作
(由 CollectionsExtension 定义。)
MapListTClient, T1
(由 Mapper 定义。)

参见