InstanceContext Constructor (Object)

 

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
)

Parameters

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

Console.WriteLine(info);

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