public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
=> ReadAsyncInternal(destination, cancellationToken);
- private unsafe ValueTask<int> ReadAsyncInternal(Memory<byte> destination, CancellationToken cancellationToken = default)
+ private unsafe ValueTask<int> ReadAsyncInternal(Memory<byte> destination, CancellationToken cancellationToken)
{
if (!CanRead)
{
}
}
}
+
+ public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state) =>
+ TaskToApm.Begin(ReadAsync(buffer, offset, count), callback, state);
+
+ public override int EndRead(IAsyncResult asyncResult) => TaskToApm.End<int>(asyncResult);
+
+ public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state) =>
+ TaskToApm.Begin(WriteAsync(buffer, offset, count), callback, state);
+
+ public override void EndWrite(IAsyncResult asyncResult) => TaskToApm.End(asyncResult);
}
}