/// <summary> /// 写入 /// </summary> /// <param name="path"></param> public void WriteToFile(string path) { using (var writer = new PeriodPrnWriter(path)) { foreach (var item in this) { writer.Write(item); } } }
/// <summary> /// 返回文本 /// </summary> public string GetText() { using (MemoryStream stream = new MemoryStream()) { var writer = new PeriodPrnWriter(stream); foreach (var item in this) { writer.Write(item); } writer.Flush(); stream.Position = 0; StreamReader reader = new StreamReader(stream); return(reader.ReadToEnd()); } }