Skip to main content

DirectoryInfo Class

NuGet: GHIElectronics.TinyCLR.IO
Assembly: GHIElectronics.TinyCLR.IO
Namespace: System.IO

Provides information about a directory and the means to create or delete it.

public sealed class DirectoryInfo : FileSystemInfo

Constructors

DirectoryInfo(string path)

public DirectoryInfo(string path)

Creates a new instance for the directory at the given path.

Properties

Name

public override string Name { get; }

The name of the file or directory. (inherited)

Parent

public DirectoryInfo Parent { get; }

The parent directory, or null if this is a root.

Exists

public override bool Exists { get; }

Whether the file or directory exists. (inherited)

Root

public DirectoryInfo Root { get; }

The root portion of the directory's path.

Methods

CreateSubdirectory(string path)

public DirectoryInfo CreateSubdirectory(string path)

Creates a subdirectory under this directory and returns it.

Returns DirectoryInfo

Create()

public void Create()

Creates the directory.

GetFiles()

public FileInfo[] GetFiles()

Returns the files contained in the directory.

Returns FileInfo[]

GetDirectories()

public DirectoryInfo[] GetDirectories()

Returns the subdirectories contained in the directory.

Returns DirectoryInfo[]

MoveTo(string destDirName)

public void MoveTo(string destDirName)

Moves the directory and its contents to a new path.

Delete()

public override void Delete()

Deletes the file or directory. (inherited)

Delete(bool recursive)

public void Delete(bool recursive)

Deletes the directory, optionally including its contents.

ToString()

public override string ToString()

Returns the full path of the directory.

Returns string