ReliableSessionBindingElement.CanBuildChannelListener<TChannel>(BindingContext) Method


Returns a value that indicates whether the channel listener can be built for the channel and context provided that can support a reliable session.

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

Type Parameters


The IChannel that the channel listener, if build, accepts.



The BindingContext that contains the information required to build the listeners that can accept channels of type TChannel.



true if the ChannelListenerBase<TChannel> that can produce an IChannel of type TChannel can be built by the binding element; otherwise, false.


Channel stacks are typically created using a factory pattern where a binding creates the channel stack. When sending messages, a binding is used to build a channel factory which in turn builds a channel stack and returns a reference to the top channel in the stack. The application can then use this channel to send messages. Similarly when receiving messages, a binding is used to build a channel listener which listens for incoming messages. The channel listener provides messages to the listening application by creating channel stacks and handing the application a reference to the top channel.

This method returns true or false for a TChannel in accordance with the table of values provided in BuildChannelListener<TChannel>(BindingContext).

Applies to