Share via


BindingElement.GetProperty<T>(BindingContext) メソッド

定義

派生クラスでオーバーライドされると、バインド スタックの適切な層から、要求のあった型指定されたオブジェクト (ある場合) を返します。

public:
generic <typename T>
 where T : class abstract T GetProperty(System::ServiceModel::Channels::BindingContext ^ context);
public abstract T GetProperty<T> (System.ServiceModel.Channels.BindingContext context) where T : class;
abstract member GetProperty : System.ServiceModel.Channels.BindingContext -> 'T (requires 'T : null)
Public MustOverride Function GetProperty(Of T As Class) (context As BindingContext) As T

型パラメーター

T

メソッドが照会している、型指定されたオブジェクト。

パラメーター

context
BindingContext

バインディング要素の BindingContext

戻り値

T

要求される型指定されたオブジェクト T がある場合は、そのオブジェクト。ない場合は null

CustomBinding binding = new CustomBinding();
HttpTransportBindingElement element = new HttpTransportBindingElement();
BindingParameterCollection parameters = new BindingParameterCollection();
parameters.Add(new ServiceCredentials());
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);

ServiceCredentials serviceCredentials = element.GetProperty<ServiceCredentials>(context);

注釈

バインド要素スタックから機能、要件、およびパラメーターを取得するには、このメソッドを使用します。 バインド要素が、要求されたオブジェクトを返せる場合は、オブジェクトを返します。 それ以外の場合は、スタック内の次のバインド要素に呼び出しを代行させます。 スタックの最下位に達しても要求されたオブジェクトをサポートするバインディング要素がない場合、メソッドは、null を返します。

注意

暗号化する必要のあるメッセージ ヘッダーを追加している場合、ChannelProtectionRequirements を求められたときに、このメソッドから、要件と共に ChannelProtectionRequirements インスタンスを返す必要があります。

適用対象