OneWayBindingElement.CanBuildChannelListener<TChannel>(BindingContext) 方法

定义

获取一个值,该值指示是否可以生成指定类型的通道侦听器。Gets a value that indicates whether a channel listener of the specified type can be built.

public:
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

类型参数

TChannel

要生成的通道侦听器的类型。The type of channel listener to build.

参数

context
BindingContext

为绑定元素提供上下文的 BindingContextThe BindingContext that provides context for the binding element.

返回

Boolean

如果可以生成指定类型的通道侦听器,则为 true;否则为 falsetrue if a channel listener of the specified type can be built; otherwise, false. 默认为 falseThe default is false.

例外

contextnullcontext is null.

注解

在尝试创建通道侦听器之前应调用此方法。You should call this method before trying to create a channel listener.

trueTChannel,并且绑定堆栈中当前绑定的下一个绑定是 IInputChannelIDuplexSessionChannel 时,此方法将返回 IReplyChannelThis method returns true when TChannel is an IInputChannel, and the binding below the present one in the binding stack is an IDuplexSessionChannel or IReplyChannel.

适用于