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;

适用于