琪琪今天给分享object 转list的知识,其中也会对object转list的方法进行解释,希望能解决你的问题,请看下面的文章阅读吧!

1、{Object[] obj =(Object[])object;先序列化,再写入到文件:1、序列化:建议用序列化工具 ,若要序列化为xml可以用 XmlSerializer, 自带,若是序列化为json字符串,可以用Newtonsoft.Json这个工具。

2、具体用法自己搜索一下;2、将上面生成的字符串写入到文件,下面是我自己常用的一个文件写函数/// 写文件/// /// 文件内容public static void WriteFile(string Path, strin比如 Listg Strings){System.IO.FileStream f = System.IO.File.Create(Path);f.Close();}System.IO.StreamWriter f2 = new System.IO.StreamWriter(Path, false, System.Text.Encoding.GetEncoding("gb2312"));f2.Write(Strings);f2.Close();f2.Dise();就是写文件啊,循环liststringstr=Guid.NewGuid().ToString();stringstrPath="C:ProgramFiles"+str+".xls";FileStreamfs=File.C}reate(strPath);StreamWritersw=newStreamWriter(fs,Encoding.Unicode);stringstrLine="";//写入列标题for(inti=0;i。

本文到这结束,希望上面文章对大家有所帮助。