This documentation is archived and is not being maintained.

Package.Flush Method

Saves the contents of all parts and relationships that are contained in the package.

Namespace: System.IO.Packaging
Assembly: WindowsBase (in windowsbase.dll)

public void Flush ()
public void Flush ()
public function Flush ()
You cannot use methods in XAML.

Exception typeCondition


The package is not open (Dispose or Close has been called).


The package is read-only and cannot be modified.

Flush internally calls the derived class FlushCore implemetation to perform the actual format-specific flush operation. The derived class FlushCore method is responsible for actually saving the part and relationship content to the specific physical subclass implementation.

By default, a ZipPackage subclass implementation of the abstract Package base class is provided and used. In the default operation, Flush internally calls FlushCore to save the parts and relationships in a ZIP file package.

Flush is called automatically by the Close and Dispose methods. When Close or Dispose is called you do not have to call Flush separately.

Notes to Implementers: Flush internally calls the derived class FlushCore method to actually flush the part based on the physical format implemented in the subclass.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0