What is the difference between these ways of getting current directory?

enter image description here

Consider the example above
The myTest.exe file contains the entry point and is at located at D:\myTest.exe. This exe calls via reflection a method in an assembly in F:\. This assembly contains all the find directory code.

In the command prompt I have my current directory set to C:\

Here are the results

AppDomain.CurrentDomain.BaseDirectory

D:\

Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)

F:\

Environment.CurrentDirectory and Directory.GetCurrentDirectory()

C:\

Leave a Comment