繁体   English   中英

使用Xamarin,如何将.csv文件上的数据存储到本地android存储?

[英]Using Xamarin, how do I store data on a .csv file to local android storage?

例如,如果我有两个数组ArrayX和ArrayY中的数据,如何将数据写入本地android存储中的.csv文件中?

这假设ArrayX和ArrayY为非空并且具有相同数量的元素

string path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "myfile.csv");

using (StreamWriter sw = File.CreateText(path))
{
    for (int ndx = 0; ndx <= ArrayX.Length; ndx++)
    {
      sw.WriteLine(ArrayX[ndx] + "," + ArrayY[ndx]);
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM