static void AsyncLocalSetCurrentUICulture(AsyncLocalValueChangedArgs<CultureInfo> args) { s_currentThreadUICulture = args.CurrentValue; }
static void AsyncLocalSetCurrentUICulture(AsyncLocalValueChangedArgs <CultureInfo> args) { s_currentThreadUICulture = args.CurrentValue; }
// This callback is used to initialize the m_current AsyncLocal Variable. // Its job is to keep the ETW Activity ID (part of thread local storage) in sync // with m_current.ActivityID void ActivityChanging(AsyncLocalValueChangedArgs<ActivityInfo> args) { if (args.PreviousValue == args.CurrentValue) return; if (args.CurrentValue != null) { // Allow subsequent activities inside this thread to automatically get the current activity ID. EventSource.SetCurrentThreadActivityId(args.CurrentValue.ActivityId); } else EventSource.SetCurrentThreadActivityId(Guid.Empty); }
static void DisplayNewLanguageTag(AsyncLocalValueChangedArgs <string> handle) { Console.WriteLine($"before: {handle.PreviousValue}"); //zh-CN Console.WriteLine($"after: {handle.CurrentValue}"); //zh-TW }