Get an array of string containing the names of the logical drives on the current computer in CSharp

Description

The following code shows how to get an array of string containing the names of the logical drives on the current computer.

Example


using System;//from   w  w  w  . j  a  va 2s .  c  o  m

class Sample 
{
    public static void Main() 
    {
       String[] drives = Environment.GetLogicalDrives();
       Console.WriteLine("GetLogicalDrives: {0}", String.Join(", ", drives));
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Development »




Console
Encoding
Environment
Random