Chỉnh sửa

InstanceContext(Object) Constructor

Definition

Initializes a new instance of the InstanceContext class for a specified object that implements the service instance.

public:
 InstanceContext(System::Object ^ implementation);
public InstanceContext(object implementation);
new System.ServiceModel.InstanceContext : obj -> System.ServiceModel.InstanceContext
Public Sub New (implementation As Object)

Parameters

implementation
Object

The object that implements the service instance.

Examples

The following code shows how to construct an InstanceContext object by passing in a ServiceHost instance:

string info = "";

InstanceContext instanceContext = new InstanceContext(serviceHost);
info += "    " + "State: " + instanceContext.State.ToString() + "\n";
info += "    " + "ManualFlowControlLimit: " + instanceContext.ManualFlowControlLimit.ToString() + "\n";
info += "    " + "HashCode: " + instanceContext.GetHashCode().ToString() + "\n";

Console.WriteLine(info);

Remarks

This sets the service host associated with the instance context to null.

Applies to