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

例外

通信オブジェクトが opened または closing 状態です。この状態では変更できません。

通信オブジェクトは既に中止されています。この状態では変更できません。

通信オブジェクトは既に閉じています。この状態では変更できません。

通信オブジェクトが faulted 状態にあります。この状態では変更できません。

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

適用対象