クリックして評価とフィードバックをお寄せください
MSDN
MSDN ライブラリ
.NET 開発
.NET Framework 3.5
.NET Framework 3.5
ServiceEndpoint クラス
ServiceEndpoint プロパティ
 Behaviors プロパティ

  低帯域幅での表示をオンにする
このページは次のバージョンについて記述しています。
Microsoft Visual Studio 2008/.NET Framework 3.5

その他のバージョンについては、以下の情報を参照してください。
.NET Framework クラス ライブラリ
ServiceEndpoint..::.Behaviors プロパティ

更新 : 2007 年 11 月

サービス エンドポイントの動作を取得します。

名前空間 :  System.ServiceModel.Description
アセンブリ :  System.ServiceModel (System.ServiceModel.dll 内)
Visual Basic (宣言)
Public ReadOnly Property Behaviors As KeyedByTypeCollection(Of IEndpointBehavior)
Visual Basic (使用法)
Dim instance As ServiceEndpoint
Dim value As KeyedByTypeCollection(Of IEndpointBehavior)

value = instance.Behaviors
C#
public KeyedByTypeCollection<IEndpointBehavior> Behaviors { get; }
Visual C++
public:
property KeyedByTypeCollection<IEndpointBehavior^>^ Behaviors {
    KeyedByTypeCollection<IEndpointBehavior^>^ get ();
}
J#
/** @property */
public KeyedByTypeCollection<IEndpointBehavior> get_Behaviors()
JScript
public function get Behaviors () : KeyedByTypeCollection<IEndpointBehavior>

プロパティ値

型 : System.Collections.Generic..::.KeyedByTypeCollection<(Of <(IEndpointBehavior>)>)
サービス エンドポイントに指定された動作を含む IEndpointBehavior 型の KeyedByTypeCollection<(Of <(TItem>)>)

説明階層からアクセスできる動作の型は、特定のレベルに限定されます。ServiceEndpoint から、IEndpointBehavior にアクセスできます。

エンドポイントに関連付けられた IContractBehavior にアクセスする場合は、Contract プロパティを使用してエンドポイントのコントラクトを取得します。次に、Behaviors プロパティを呼び出して、エンドポイントに関連付けられている IContractBehavior オブジェクトの KeyedByTypeCollection<(Of <(TItem>)>) を取得します。

カスタム エンドポイント動作を追加し、その動作にアクセスする方法を次のコードに示します。

C#
Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

ServiceEndpoint endpoint = serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

endpoint.Behaviors.Add(new MyEndpointBehavior());

Console.WriteLine("List all behaviors:");
foreach (IEndpointBehavior behavior in endpoint.Behaviors)
{
    Console.WriteLine("Behavior: {0}", behavior.ToString());
}

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

.NET Framework

サポート対象 : 3.5、3.0
コミュニティ コンテンツ   コミュニティ コンテンツとは
新しいコンテンツの追加 RSS  注釈
Processing
© 2009 Microsoft Corporation. All rights reserved. 使用条件  |  商標  |  プライバシー
Page view tracker