Created
July 5, 2015 00:03
-
-
Save Fhernd/8aa2c03f763175ad4af4 to your computer and use it in GitHub Desktop.
Uso de la clase `DriveInfo` en C#.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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