NamedPipeTransportBindingElement.BuildChannelListener<TChannel> 方法

定义

创建指定类型的通道侦听器。

public:
generic <typename TChannel>
 where TChannel : class, System::ServiceModel::Channels::IChannel override System::ServiceModel::Channels::IChannelListener<TChannel> ^ BuildChannelListener(System::ServiceModel::Channels::BindingContext ^ context);
public override System.ServiceModel.Channels.IChannelListener<TChannel> BuildChannelListener<TChannel> (System.ServiceModel.Channels.BindingContext context) where TChannel : class, System.ServiceModel.Channels.IChannel;
override this.BuildChannelListener : System.ServiceModel.Channels.BindingContext -> System.ServiceModel.Channels.IChannelListener<'Channel (requires 'Channel : null and 'Channel :> System.ServiceModel.Channels.IChannel)> (requires 'Channel : null and 'Channel :> System.ServiceModel.Channels.IChannel)
Public Overrides Function BuildChannelListener(Of TChannel As {Class, IChannel}) (context As BindingContext) As IChannelListener(Of TChannel)

类型参数

TChannel

要创建的通道侦听器的类型。

参数

context
BindingContext

一些成员,描述创建通道工厂所需的绑定、行为、协定和其他信息。

返回

返回指定类型的通道侦听器。

例外

context 不能为 null

传递的自变量无效。

示例

此示例演示如何创建指定类型的通道侦听器:

IChannelListener<IOutputChannel> listener =
    binding.BuildChannelListener<IOutputChannel>(bContext);
Dim listener As IChannelListener(Of IOutputChannel) = binding.BuildChannelListener(Of IOutputChannel)(bContext)

注解

此方法可用于获取指定类型的通道侦听器,以基于命名管道绑定元素的配置接收消息。

适用于