获取启动项路径
1.Environment.CurrentDirectory System.IO.Path.Combine(Environment.CurrentDirectory, @"Data\Data.db")
2.System.Windows.Forms.Application.StartupPath
获取文件列表
DirectoryInfo dirInfo = new DirectoryInfo(System.IO.Path.Combine(Environment.CurrentDirectory, @"Models")); foreach (FileInfo item in dirInfo.GetFiles("*.md")) { ControlModelFile.Add(item.Name); }
删除文件
FileInfo fileInfo = new FileInfo(path); fileInfo.Delete();
确认文件是否存在
File.Exist(FileInfo.FullName)