コード例 #1
0
ファイル: TaskAwaiterHelper.cs プロジェクト: ebt/SignalRSlim
 private static void PreserveCultureUnsafeOnCompleted(ICriticalNotifyCompletion notifier,
                                                      Action continuation,
                                                      bool useSyncContext)
 {
     // Rely on the SyncContext to preserve culture if it exists
     if (useSyncContext && SynchronizationContext.Current != null)
     {
         notifier.UnsafeOnCompleted(continuation);
     }
     else
     {
         var preservedCulture = TaskAsyncHelper.SaveCulture();
         notifier.UnsafeOnCompleted(() =>
         {
             TaskAsyncHelper.RunWithPreservedCulture(preservedCulture, continuation);
         });
     }
 }