Esempio n. 1
0
        private async Task SerializeTextToStreamAsync(Stream stream)
        {
            using var base64RequestStream = new Base64RequestStream(stream);
            await _inner.CopyToAsync(base64RequestStream).ConfigureAwait(false);

            // Any remaining content needs to be written when SerializeToStreamAsync finishes.
            // We want to avoid unnecessary flush calls so a custom method is used to write
            // ramining content rather than calling FlushAsync.
            await base64RequestStream.WriteRemainderAsync(CancellationToken.None).ConfigureAwait(false);
        }