C# DriveInfo DriveType
Description
DriveInfo DriveType
Gets the drive type, such as CD-ROM,
removable, network, or fixed.
Syntax
DriveInfo.DriveType
has the following syntax.
public DriveType DriveType { get; }
Example
Gets the drive type, such as CD-ROM, removable, network, or fixed.
/* w w w. java 2s .co m*/
using System;
using System.IO;
class Test
{
public static void Main()
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine(" File type: {0}", d.DriveType);
}
}
}
The code above generates the following result.