ApplicationDeployment.DataDirectory 属性
方法一:
string dataDir = (string)AppDomain.CurrentDomain.GetData("DataDirectory");
方法二:
ApplicationDeployment.CurrentDeployment.DataDirectory;
取得路径的位置类似:
C:Users用户名AppDataLocalApps2.0DataWAHDOYRT.87ANX24N2BN.WVDclic..tion_9c409efd14730c52_0001.0000_97346d341e3f8e57Data
注:红色文字为随机生成的文件夹。
其它获取路径的方法:
String path1 = System.AppDomain.CurrentDomain.BaseDirectory; String path2 = System.IO.Directory.GetCurrentDirectory(); String path3 = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;