首页 > 代码库 > Winphone 删除文件夹IsolatedStorageFile.DeleteDirectory
Winphone 删除文件夹IsolatedStorageFile.DeleteDirectory
Winphone 没有直接删除文件夹的接口(因为文件夹不为空是删除不了的),所以要自己实现 public static void DeleteDirectoryRecursively(this IsolatedStorageFile storageFile, String dirName){ String pattern = dirName + @"\*"; String[] files = storageFile.GetFileNames(pattern); foreach (var fName in files) { storageFile.DeleteFile(Path.Combine(dirName, fName)); } String[] dirs = storageFile.GetDirectoryNames(pattern); foreach (var dName in dirs) { DeleteDirectoryRecursively(storageFile, Path.Combine(dirName, dName)); } storageFile.DeleteDirectory(dirName);}
http://stackoverflow.com/questions/18422331/easy-way-to-recursively-delete-directories-in-isolatedstorage-on-wp7-8
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。