美文网首页
关于Xamarin的坑(三)

关于Xamarin的坑(三)

作者: Yaphet_Wang | 来源:发表于2019-03-11 17:20 被阅读0次

    Xamarin.Andorid中的读写CSV操作,原代码:

    if (!File.Exists(fullPath))

    {

    File.CreateText(fullPath);

     }

    if (fs == null || fs.CanWrite == false)

    {

    FileStream fs = new FileStream(fullPath, System.IO.FileMode.Append, System.IO.FileAccess.Write);

    StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8);

    }

    运行出错,错误提示“System.IO.IOException: Sharing violation on path......”

    解决方法:

    代码修改为:File.CreateText(fullPath).Dispose();

    相关文章

      网友评论

          本文标题:关于Xamarin的坑(三)

          本文链接:https://www.haomeiwen.com/subject/zlvbpqtx.html