Partager via


CallbackBehaviorAttribute.UseSynchronizationContext Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that specifies whether to use the current synchronization context to choose the thread of execution.

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

Syntax

'Declaration
Public Property UseSynchronizationContext As Boolean
public bool UseSynchronizationContext { get; set; }

Property Value

Type: System.Boolean
true if all calls to the service must run on the thread specified by the SynchronizationContext; otherwise, false. The default value is true.

Remarks

Use this property to provide the user interface thread affinity that some applications require. The default case, in which UseSynchronizationContext is set to true, synchronizes all calls to the service to run on the user interface thread.

Note that the thread used is the current synchronization thread when DuplexChannelFactory<TChannel>.CreateChannel or DuplexClientBase<TChannel>.CreateChannel is called.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.