InstanceContext.SynchronizationContext 속성

정의

현재 인스턴스 컨텍스트와의 스레드 동기화에 사용되는 컨텍스트를 가져오거나 설정합니다.

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

속성 값

SynchronizationContext 현재 인스턴스 컨텍스트와의 스레드 동기화에 사용됩니다.

예외

통신 개체가 열리거나 닫히고 이러한 상태에서는 수정할 수 없습니다.

통신 개체가 중단되었으며 이러한 상태에서는 수정할 수 없습니다.

통신 개체가 이미 닫혀 있으며 이러한 상태에서는 수정할 수 없습니다.

통신 개체에 오류가 발생하며 이러한 상태에서는 수정할 수 없습니다.

예제

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

적용 대상