共用方式為


MsmqTransportBindingElement.CanBuildChannelListener<TChannel> 方法

定義

傳回布林值,這個值會指出您是否可以使用所提供的內容來建置通道接聽程式。

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

要用於建置通道接聽程式的通道型別。 允許的通道型別為 IInputSessionChannelIInputChannel 類別。

參數

context
BindingContext

用來建置通道接聽程式的 BindingContext

傳回

如果可以使用所提供的內容來建置通道接聽程式,則為 true,否則為 false

只有當 trueTChannelIInputChannel 時,此繫結才會傳回 IInputSessionChannel

範例

if (transportBindingElement.CanBuildChannelListener<IInputChannel>(context))
{
    // Do something...
}

適用於