首页 > 移动平台 > 详细

【C#遗补】获取应用程序路径之System.IO.Directory.GetCurrentDirectory和System.Windows.Forms.Application.StartupPath的区别

时间:2015-06-09 16:55:22      阅读:332      评论:0      收藏:0      [点我收藏+]
原文:【C#遗补】获取应用程序路径之System.IO.Directory.GetCurrentDirectory和System.Windows.Forms.Application.StartupPath的区别

.Net Framework中,System.IO.Directory.GetCurrentDirectory()方法用于获得应用程序当前工作目录

如果使用此方法获得应用程序所在的目录,应该注意:System.IO.Directory.GetCurrentDirectory()方法获得的目录路径随着OpenFileDialog、SaveFileDialog等对象所确定的目录而改变(切换工作目录)

一般情况下,应该使用System.Windows.Forms.Application.StartupPathSystem.AppDomain.CurrentDomain.BaseDirectory来获得应用程序所在的目录

【C#遗补】获取应用程序路径之System.IO.Directory.GetCurrentDirectory和System.Windows.Forms.Application.StartupPath的区别

原文:http://www.cnblogs.com/lonelyxmas/p/4563708.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!