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