Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. using System;
  2. using System.IO;
  3.  
  4. namespace Receta.CSharp.R0501
  5. {
  6.     public class UsoDriveInfo
  7.     {
  8.         public static void Main()
  9.         {
  10.             Console.WriteLine ();
  11.            
  12.             // Obtención de las unidades actuales en el sistema:
  13.             DriveInfo[] unidades = DriveInfo.GetDrives();
  14.            
  15.             // Enlistamiento:
  16.             foreach (DriveInfo unidad in unidades)
  17.             {
  18.                 if (unidad.IsReady == true)
  19.                 {
  20.                     Console.WriteLine("Letra unidad:   {0}", unidad.Name);
  21.                     Console.WriteLine("Formato unidad: {0}", unidad.DriveFormat);
  22.                     Console.WriteLine("Nombre volumen: {0}", unidad.VolumeLabel);
  23.                     Console.WriteLine ();
  24.                 }
  25.             }
  26.            
  27.             Console.WriteLine();
  28.         }
  29.     }
  30. }