コード例 #1
0
 public MyDisposable(StreamRpcClientHandler owner, CancellationTokenSource readerCts, MessageWriter writer)
 {
     Debug.Assert(owner != null);
     Debug.Assert(readerCts != null || writer != null);
     this.owner     = owner;
     this.readerCts = readerCts;
     this.writer    = writer;
 }
コード例 #2
0
 /// <inheritdoc />
 public void Dispose()
 {
     if (owner == null)
     {
         return;
     }
     readerCts?.Cancel();
     if (owner.writer == writer)
     {
         owner.writer = null;
     }
     readerCts = null;
     writer    = null;
     owner     = null;
 }