InstanceContext Constructor (Object)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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

Namespace:   System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public InstanceContext(
	object implementation


Type: System.Object

The object that implements the service instance.

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

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";


Universal Windows Platform
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Available since 3.0
Return to top