InstanceContext.SynchronizationContext Eigenschap

Definitie

Hiermee wordt de context opgehaald of ingesteld die wordt gebruikt voor threadsynchronisatie met de huidige instantiecontext.

public:
 property System::Threading::SynchronizationContext ^ SynchronizationContext { System::Threading::SynchronizationContext ^ get(); void set(System::Threading::SynchronizationContext ^ value); };
public System.Threading.SynchronizationContext SynchronizationContext { get; set; }
member this.SynchronizationContext : System.Threading.SynchronizationContext with get, set
Public Property SynchronizationContext As SynchronizationContext

Waarde van eigenschap

Het SynchronizationContext wordt gebruikt voor threadsynchronisatie met de huidige instantiecontext.

Uitzonderingen

Het communicatieobject wordt geopend of gesloten en kan niet worden gewijzigd in deze statussen.

Het communicatieobject is afgebroken en kan niet worden gewijzigd in deze statussen.

Het communicatieobject is al gesloten en kan niet worden gewijzigd in deze statussen.

Het communicatieobject is beschadigd en kan niet worden gewijzigd in deze statussen.

Voorbeelden

Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/service");

// Create a ServiceHost for the CalculatorService type and provide the base address.
using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress))
{
    serviceHost.Open();
    OperationContext operationContext = OperationContext.Current;
    InstanceContext instanceContext = operationContext.InstanceContext;
    SynchronizationContext syncCon = instanceContext.SynchronizationContext;
}

Van toepassing op