ServiceExtensionGetClientTClient 方法
从连接服务中获取指定ID的客户端。
命名空间: TouchSocket.Sockets程序集: TouchSocket (在 TouchSocket.dll 中) 版本:3.0.0+ccaf96084d09f972257496d1dd63b8ba3c1e44f0
public static TClient GetClient<TClient>(
this IConnectableService<TClient> connectableService,
string id
)
where TClient : IIdClient, IClient
<ExtensionAttribute>
Public Shared Function GetClient(Of TClient As {IIdClient, IClient}) (
connectableService As IConnectableService(Of TClient),
id As String
) As TClient
[<ExtensionAttribute>]
static member GetClient :
connectableService : IConnectableService<'TClient> *
id : string -> 'TClient when 'TClient : IIdClient and IClient
- connectableService IConnectableServiceTClient
- 一个可连接的服务实例,提供了访问其客户端集合的方法。
- id String
- 要查找的客户端的唯一标识符。
- TClient
- 客户端的类型,必须同时实现IIdClient和IClient接口。
TClient如果找到指定ID的客户端,则返回该客户端;否则,抛出
ClientNotFindException异常。在 Visual Basic 和 C# 中,这个方法可以当成为类型
IConnectableServiceTClient 的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考
扩展方法 (Visual Basic) 或
扩展方法 (C# 编程指南) 获取更多信息。