Share via


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)

Syntax

'Declaration
Public Sub Delete ( _
    recursive As Boolean _
)
public void Delete(
    bool recursive
)
public:
void Delete(
    bool recursive
)
member Delete : 
        recursive:bool -> unit 
public function Delete(
    recursive : boolean
)

Parameters

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

Remarks

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.

.NET Framework Security

See Also

Reference

DirectoryInfo Class

Delete Overload

System.IO Namespace