Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- namespace Receta.CSharp.R0501
- {
- public class UsoDirectoryInfo
- {
- public static void Main()
- {
- Console.WriteLine ();
- // Creación instancia de `DirectoryInfo`:
- DirectoryInfo infoDirectorio = new DirectoryInfo("A:\\C#\\VisualCSharp2010Recipes\\Cap04");
- // Valida que el directorio exista:
- if (infoDirectorio.Exists)
- {
- Console.WriteLine("Listado de subdirectorios de `Cap04`:");
- // Obtiene el listado de subdirectorios:
- DirectoryInfo[] subdirectorios = infoDirectorio.GetDirectories();
- // Enlista los subdirectorios:
- foreach (DirectoryInfo dri in subdirectorios)
- {
- Console.WriteLine ("-- {0}", dri.Name);
- }
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement