Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 5, 2015 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/8aa2c03f763175ad4af4 to your computer and use it in GitHub Desktop.
Save Fhernd/8aa2c03f763175ad4af4 to your computer and use it in GitHub Desktop.
Uso de la clase `DriveInfo` en C#.
using System;
using System.IO;
namespace Receta.CSharp.R0501
{
public class UsoDriveInfo
{
public static void Main()
{
Console.WriteLine ();
// Obtención de las unidades actuales en el sistema:
DriveInfo[] unidades = DriveInfo.GetDrives();
// Enlistamiento:
foreach (DriveInfo unidad in unidades)
{
if (unidad.IsReady == true)
{
Console.WriteLine("Letra unidad: {0}", unidad.Name);
Console.WriteLine("Formato unidad: {0}", unidad.DriveFormat);
Console.WriteLine("Nombre volumen: {0}", unidad.VolumeLabel);
Console.WriteLine ();
}
}
Console.WriteLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment