Get all logical drives in CSharp
Description
The following code shows how to get all logical drives.
Example
// w w w . j av a 2 s . c o m
using System;
using System.IO;
class MaionClass
{
public static void Main(String[] args)
{
string[] drives = Directory.GetLogicalDrives();
Console.WriteLine("Here are your drives:");
foreach(string s in drives)
{
Console.WriteLine("--> {0}", s);
}
}
}
The code above generates the following result.