示例#1
0
 public static IDisposable CombineWith(this IDisposable disposable, [InstantHandle] Action setup = null, [InstantHandle] Action cleanup = null)
 {
     return(DelegateDisposable.CreateBracket(
                setup,
                () =>
     {
         cleanup?.Invoke();
         disposable.Dispose();
     }));
 }
示例#2
0
 public IDisposable Indent()
 {
     return DelegateDisposable.CreateBracket(
         () => _indentation++,
         () => _indentation--);
 }