RegistryKey.Flush Method


Writes all the attributes of the specified open registry key into the registry.

 void Flush();
public void Flush ();
member this.Flush : unit -> unit
Public Sub Flush ()


It is not necessary to call Flush to write out changes to a key. Registry changes are flushed to disk when the registry uses its lazy flusher. Lazy flushing occurs automatically and regularly after a system-specified time interval. Registry changes are also flushed to disk at system shutdown.

Unlike Close, the Flush function returns only when all the data has been written to the registry.

The Flush function might also write out parts of or all of the other keys. Calling this function excessively can have a negative effect on an application's performance.

An application should only call Flush if it must be absolute certain that registry changes are recorded to disk. In general, Flush rarely, if ever, need be used.

Applies to

See also