Winphone 删除文件夹IsolatedStorageFile.DeleteDirectory
2020-12-13 06:16
标签:winphone 删除文件夹isolatedstoragefile.deletedirectory http://stackoverflow.com/questions/18422331/easy-way-to-recursively-delete-directories-in-isolatedstorage-on-wp7-8 Winphone 删除文件夹IsolatedStorageFile.DeleteDirectory,搜素材,soscw.com Winphone 删除文件夹IsolatedStorageFile.DeleteDirectory 标签:winphone 删除文件夹isolatedstoragefile.deletedirectory 原文地址:http://fanxz.blog.51cto.com/4040922/1538023Winphone 没有直接删除文件夹的接口(因为文件夹不为空是删除不了的),所以要自己实现
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);}
文章标题:Winphone 删除文件夹IsolatedStorageFile.DeleteDirectory
文章链接:http://soscw.com/essay/32788.html