System.IO.Compression.ZipArchiveFile.Create C# (CSharp) Méthode

Create() public méthode

Truncates the archiveFile represented by the ZipArchiveFile to be empty and returns a Stream that can be used to write (binary) data into it.
public Create ( ) : Stream
Résultat Stream
        public Stream Create()
        {
            if (IsReadOnly)
            {
                throw new InvalidOperationException("Archive is ReadOnly");
            }
            if (_uncompressedData != null && (_uncompressedData.CanWrite || _uncompressedData.CanRead))
            {
                throw new InvalidOperationException("ZipArchiveFile already open.");
            }

            // abandon any old data
            _compressedData = null;
            _positionOfCompressedDataInArchive = 0;
            _compressedLength = 0;

            // We allocate some buffer so that GetBuffer() does not return null.
            _uncompressedData = new RepairedMemoryStream(256);
            return _uncompressedData;
        }