Created
July 18, 2015 12:24
-
-
Save Fhernd/32e67f78e7a0c9a0adb3 to your computer and use it in GitHub Desktop.
Uso de rutas relativas 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
// OrtizOL - xCSw - http://ortizol.blogspot.com | |
using System; | |
using System.IO; | |
namespace Receta.CSharp.R0514 | |
{ | |
public class UsoRutaRelativa | |
{ | |
public static void Main() | |
{ | |
Console.WriteLine(Environment.NewLine); | |
// Asumimos que la ruta actual es A:\C#\VisualCSharp2010Recipes\Cap05\R05-13: | |
string rutaActual = @"..\R05-13"; | |
Directory.SetCurrentDirectory(rutaActual); | |
// Muestra la ruta actual: | |
Console.WriteLine("El directorio de trabajo actual es: {0}", Directory.GetCurrentDirectory()); | |
Console.WriteLine(); | |
// Cambiamos la ruta actual: | |
Directory.SetCurrentDirectory(@"..\R05-14"); | |
// Muestra la nueva ruta de trabajo: | |
Console.WriteLine("El directorio de trabajo actual es: {0}", Directory.GetCurrentDirectory()); | |
Console.WriteLine(Environment.NewLine); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment