DirectoryInfo Class

System.IO

Represents a directory on a file system.

Syntax

public sealed class DirectoryInfo : FileSystemInfo

Description

The DirectoryInfo class provides instance methods for creating, moving, and enumerating through directories and subdirectories. It is used to interact with directories on a file system and to obtain information about them. This class is useful when you need to perform operations on a specific directory, such as listing its contents, checking its existence, or retrieving its attributes. It inherits from FileSystemInfo, which provides common properties and methods for file system objects like name, creation time, and last write time.

Members

Constructors

Properties

Methods

Remarks

The DirectoryInfo class is part of the System.IO namespace, which provides types that allow reading and writing to and from a variety of data sources and storage media. When working with file system operations, it's important to handle exceptions such as DirectoryNotFoundException, UnauthorizedAccessException, and IOException.

See Also