Delete Method (Boolean)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Deletes this instance of a DirectoryInfo, specifying whether to delete subdirectories and files.

Namespace:  System.IO
Assembly:  System.IO (in System.IO.dll)

public void Delete(
	bool recursive
)

Parameters

recursive
Type: System..::..Boolean
true to delete this directory, its subdirectories, and all files; otherwise, false.

If the DirectoryInfo has no files or subdirectories, this method deletes the DirectoryInfo even if recursive is false. Attempting to delete a DirectoryInfo that is not empty when recursive is false throws an IOException.

Show: