The following code example determines How to get all logical drives of a system and prints that.
Step 1:-Add the following namespaces
Step 2:-Initilizes variables
string drives = System.IO.Directory.GetLogicalDrives();
Step 3:-Print all the logical drives
foreach (string str in drives)
Special Note:- Directory class is static and all methods can be called without creating any instance of this class