What is the difference between these ways of getting current directory?
They all give the same result, the location of folder that contains the
exe that is being executed. I am sure there are no good or bad methods in
the .net BCL. They are all appropriate in particular circumstances. Which
one is appropriate for which scenario?
var appBaseDir = AppDomain.CurrentDomain.BaseDirectory;
var currentDir = Environment.CurrentDirectory;
var dir = Directory.GetCurrentDirectory();
var path =
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
No comments:
Post a Comment