温馨提示×

c#怎么获取当前程序的路径

c#
小亿
83
2024-03-01 09:35:08
栏目: 编程语言

在C#中,可以使用System.AppDomain.CurrentDomain.BaseDirectory属性来获取当前程序的路径。示例如下:

string currentPath = System.AppDomain.CurrentDomain.BaseDirectory;
Console.WriteLine(currentPath);

这样就可以获取到当前程序的路径并输出到控制台。

0