Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

OperationContextScope Constructor (IContextChannel^)

 

Initializes a new instance of the OperationContextScope class that uses the specified IContextChannel to create a new OperationContext for the scope.

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

public:
OperationContextScope(
	IContextChannel^ channel
)

Parameters

channel
Type: System.ServiceModel::IContextChannel^

The channel to use when creating the scope for a new OperationContext.

Use the OperationContextScope constructor to create a new OperationContext for a client channel that can be used to add or modify outbound message headers, read incoming message headers, or access other run-time properties of the OperationContext.

The headers added to the OperationContext::IncomingMessageHeaders property of the newly created OperationContext apply only to the channel that was passed to the OperationContextScope constructor. If the user creates a new channel within its scope then the headers are not applied to messages sent on the new channel.

The following example shows how to use the OperationContextScope to create a new context in a client application in order to add a custom header to the outgoing message.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2017 Microsoft