public static void WriteCsv(IEnumerable <PbTick> list, string output) { if (list == null) { return; } var Codec = new PbTickCodec(); // 将差分数据生成界面数据 IEnumerable <PbTickView> _list = Codec.Data2View(Codec.Restore(list), false); // 保存 using (TextWriter stream = new StreamWriter(output)) { var t = new PbTickView(); stream.WriteLine(t.ToCsvHeader()); foreach (var l in _list) { stream.WriteLine(l); } stream.Close(); } }
public static void WriteCsv(IEnumerable<PbTick> list, string output) { if (list == null) return; PbTickCodec Codec = new PbTickCodec(); // 将差分数据生成界面数据 IEnumerable<PbTickView> _list = Codec.Data2View(Codec.Restore(list), false); // 保存 using (TextWriter stream = new StreamWriter(output)) { PbTickView t = new PbTickView(); stream.WriteLine(t.ToCsvHeader()); foreach (var l in _list) { stream.WriteLine(l); } stream.Close(); } }