Esempio n. 1
0
        internal static IAsyncOperationWithProgress <uint, uint> WriteAsyncOperation(this Stream stream, IBuffer buffer)
        => AsyncOperationWithProgress.FromFuncAsync <uint, uint>(async(ct, op) =>
        {
            await stream.WriteAsync(buffer, ct);

            return(buffer.Length);
        });
Esempio n. 2
0
        internal static IAsyncOperationWithProgress <IBuffer, uint> ReadAsyncOperation(this Stream stream, IBuffer buffer, uint count, InputStreamOptions options)
        => AsyncOperationWithProgress.FromFuncAsync <IBuffer, uint>(async(ct, op) =>
        {
            await stream.ReadAsync(buffer, count, options, ct);

            return(buffer);
        });