You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$10
For Premium members:
In this article I will explain you about Directory and DirectoryInfo Classes in C#.
This article has been excerpted from book "The Complete Visual C# Programmer's Guide" from the Authors of C# Corner.The Directory and DirectoryInfo classes are used to perform various operations on directories such as Create, Move, Delete, and Enumerate. The functional distinction between these classes is the same as that between the File and FileInfo classes: the Directory class provides static methods whereas the DirectoryInfo class provides instance methods to deal with directories. Below, Table 6.2 compares these directory classes. Table 6.2: Directory and DirectoryInfo class members Like the FileInfo class, the DirectoryInfo class also has a single constructor that takes either the full path or relative path to the directory as the input parameter: DirectoryInfo d1 = new DirectoryInfo(@"c:\temp"); //Make a directory objectSome important properties of the DirectoryInfo class, such as CreationTime, Exists, FullName, LastAccessTime, LastWriteTime, Name, Parent, and Root, work as their names suggest. For example, CreationTime shows the creation time of the directory. FullName is the full qualified path of the directory, while Name is just the relative folder name without the path (e.g., a directory with the FullName of c:\My Project\test would have a Name of test). ConclusionHope this article would have helped you in understanding Directory and DirectoryInfo Classes in C#. See other articles on the website on .NET and C#.
Object Oriented Programming Using C#