BindingElement.CanBuildChannelListener<TChannel>(BindingContext) メソッド

定義

バインディング要素が特定の種類のチャネルのリスナーを構築できるかどうかを示す値を返します。

public:
generic <typename TChannel>
 where TChannel : class, System::ServiceModel::Channels::IChannel virtual bool CanBuildChannelListener(System::ServiceModel::Channels::BindingContext ^ context);
public virtual bool CanBuildChannelListener<TChannel>(System.ServiceModel.Channels.BindingContext context) where TChannel : class, System.ServiceModel.Channels.IChannel;
abstract member CanBuildChannelListener : System.ServiceModel.Channels.BindingContext -> bool (requires 'Channel : null and 'Channel :> System.ServiceModel.Channels.IChannel)
override this.CanBuildChannelListener : System.ServiceModel.Channels.BindingContext -> bool (requires 'Channel : null and 'Channel :> System.ServiceModel.Channels.IChannel)
Public Overridable Function CanBuildChannelListener(Of TChannel As {Class, IChannel}) (context As BindingContext) As Boolean

型パラメーター

TChannel

リスナーが受け入れるチャネルの種類。

パラメーター

context
BindingContext

バインド要素のコンテキストを提供する BindingContext

返品

true IChannelListener<TChannel>型のIChannelをバインド要素でビルドできる場合は。それ以外の場合はfalse

例外

contextnullです。

CustomBinding binding = new CustomBinding();
HttpTransportBindingElement element = new HttpTransportBindingElement();
BindingParameterCollection parameters = new BindingParameterCollection();
Uri baseAddress = new Uri("http://localhost:8000/ChannelApp");
String relAddress = "http://localhost:8000/ChannelApp/service";
BindingContext context = new BindingContext(binding, parameters, baseAddress, relAddress, ListenUriMode.Explicit);

bool bFlag = element.CanBuildChannelListener<IReplyChannel>(context);

注釈

このメソッドは、 TChannel タイプのチャネルのチャネル リスナーが、リスナーのビルドを試みる前に指定された context に対してビルドできることを確認する場合に使用します。 または、 BuildChannelListener を呼び出してチャネル リスナーをビルドし、構築できない場合に生成された例外をキャッチします。

適用対象