共用方式為


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)

備註

這個方法可以用來取得特定型別的通道接聽項,以便依據具名管道繫結項目的組態接收訊息。

適用於