public void Dispose() { if (oldValue == null) { properties.RemoveProperty(key); } else { properties.SetProperty(key, oldValue); } }
public static IDisposable Use <TValue>(this IContextProperties properties, string key, TValue value) { properties.Current.TryGetValue(key, out var oldValue); properties.SetProperty(key, value); return(new ContextScope(key, oldValue, properties)); }
public static void Set <TValue>(this IContextProperties properties, string key, TValue value) { properties.SetProperty(key, value); }