Dispose() public method

Flushes any buffered data and optionally closes the underlying stream, if any.

By default, any underlying stream is closed by this method. To configure this behaviour, use a constructor overload with a leaveOpen parameter. If this instance does not have an underlying stream, this method does nothing.

For the sake of efficiency, calling this method does not prevent future write calls - but if a later write ends up writing to a stream which has been disposed, that is likely to fail. It is recommend that you not call any other methods after this.

public Dispose ( ) : void
return void
示例#1
0
        /// <summary>
        /// clear Pool
        /// </summary>
        public static void PoolDispose()
        {
#if POOL
            if (_sharedInputSteam != null)
            {
                _sharedInputSteam.Dispose();
                _sharedInputSteam = null;
            }

            if (_sharedOutSteam != null)
            {
                _sharedOutSteam.Dispose();
                _sharedOutSteam = null;
            }
#endif
        }
        public void Dispose_FromByteArray()
        {
            var stream = new CodedOutputStream(new byte[10]);

            stream.Dispose();
        }