//returns whether or not I completed. static bool HandleWriteBlockAsync(IAsyncResult result, WriteValueAsyncResult thisPtr) { Task task = (Task)result; if (task == null) { task = thisPtr.writer.WriteBase64Async(thisPtr.block, 0, thisPtr.bytesRead); task.AsAsyncResult(onContinueWork, thisPtr); return false; } task.GetAwaiter().GetResult(); return true; }
//returns whether or not I completed. static bool HandleWriteBlock(IAsyncResult result, WriteValueAsyncResult thisPtr) { if (result == null) { result = thisPtr.writer.BeginWriteBase64(thisPtr.block, 0, thisPtr.bytesRead, onContinueWork, thisPtr); if (!result.CompletedSynchronously) { return false; } } thisPtr.writer.EndWriteBase64(result); return true; }