Winphone 删除文件夹IsolatedStorageFile.DeleteDirectory

发布时间:2020-07-18 17:19:51 作者:南倭瓜
来源:网络 阅读:381
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


推荐阅读:
  1. 518抽奖软件源码之:删除文件夹及下面的所有文件
  2. Angular和AngularJS的区别是什么

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

删除文件夹 winphone age

上一篇:Python如何基于smtplib协议实现发送邮件

下一篇:C#中RSA算法的详解

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》