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 を呼び出してチャネル リスナーを作成し、作成できない場合は生成される例外をキャッチします。

適用対象