示例#1
0
        /// <summary>
        ///     Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing">
        ///     <c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only
        ///     unmanaged resources.
        /// </param>
        protected virtual async ValueTask DisposeAsync(bool disposing)
        {
            if (disposing)
            {
                await _sampler.WriteAsync(_stream);

#if NETSTANDARD2_1
                _stream?.DisposeAsync();
#else
                _stream?.Dispose();
#endif
            }
        }