public BeginWrite ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult | ||
buffer | byte | |
offset | int | |
count | int | |
callback | AsyncCallback | |
state | object | |
return | IAsyncResult |
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{
if (_isAsync)
return TaskToApm.Begin(WriteAsync(buffer, offset, count, CancellationToken.None), callback, state);
else
return base.BeginWrite(buffer, offset, count, callback, state);
}
PipeStream::BeginWrite ( byte buffer, int offset, int count, System callback, object state ) : System.IAsyncResult |
public void OnAsyncMessage(PipeStream pipe, Byte [] data, Int32 bytes, Object state) { Console.WriteLine("Message: " + (Int32) state + " bytes: " + bytes); data = Encoding.UTF8.GetBytes(Encoding.UTF8.GetString(data, 0, bytes).ToUpper().ToCharArray()); // Write results try { pipe.BeginWrite(data, 0, bytes, OnAsyncWriteComplete, pipe); } catch (Exception) { pipe.Close(); } }