Pfad vom Assembly aus bestimmen
Freitag, 19. Dezember 2008 | Autor: admin
Verwendung beim Testing um zu einem bestimmten Ordner zu navigieren:
public static string GetRootPath { get { string path = Path.Combine(typeof(ACTUALCLASS).Assembly.Location, PathToRoot); return new DirectoryInfo(path).FullName; } }
Mit Assembly.Location wird der aktuelle Pfad zur Assembly ausgelesen. PathToRoot (z.B. @..\..\Folder\Subfolder) enthält als Konstante den Pfad zum gewünschten Root-Ordner.


