共用方式為


InstanceContext.Extensions 屬性

定義

取得與服務執行個體相關的延伸集合 (若有的話)。

public:
 property System::ServiceModel::IExtensionCollection<System::ServiceModel::InstanceContext ^> ^ Extensions { System::ServiceModel::IExtensionCollection<System::ServiceModel::InstanceContext ^> ^ get(); };
public System.ServiceModel.IExtensionCollection<System.ServiceModel.InstanceContext> Extensions { get; }
member this.Extensions : System.ServiceModel.IExtensionCollection<System.ServiceModel.InstanceContext>
Public ReadOnly Property Extensions As IExtensionCollection(Of InstanceContext)

屬性值

IExtensionCollection<InstanceContext>

IExtensionCollection<T> 型別的 InstanceContext,其中包含服務執行個體延伸的執行個體內容。

實作

例外狀況

與此內容相關的服務執行個體已關閉,但未中止。

與此內容相關的服務執行個體處於錯誤狀態。

範例

下列程式碼示範如何存取 Extensions 屬性:

Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/service");
CalculatorService service = new CalculatorService();
ServiceHost serviceHost = new ServiceHost(service, baseAddress);
InstanceContext instanceContext = new InstanceContext(serviceHost, service);

IExtensionCollection<InstanceContext> extensions = instanceContext.Extensions;

適用於