Don’t use Directory.GetCurrentDirectory() to get current directory in .NET
In some cases, using Directory.GetCurrentDirectory() can change the behavior of application because the current directory can be changed by calling Directory.SetCurrentDirectory. For complicated applications, changing the current directory can happen. The best would be using AppDomain.CurrentDomain.BaseDirectory to get the application base directory containing the folder of executable program.
Hope this small post could help you!
Happy coding 😊😊
Comments
Post a Comment