![]() |
VOOZH | about |
A directory is a file system that stores file. Now our task is to create a directory in C#. We can create a directory by using the CreateDirectory() method of the Directory class. This method is used to create directories and subdirectories in a specified path. If the specified directory exists or the given path is invalid then this method will not create a directory. To use CreateDirectory() method we have to import the system.IO namespace in the program.
Syntax:
public static System.IO.DirectoryInfo CreateDirectory (string path);
Parameter: path is the directory path.
Return: This will return the object of the specified created directory.
Exception: It will throw the following exception:
Example:
Output:
Created👁 Image