public static string ToText(IEnumerable records) { using (var stream = new MemoryStream()) using (var reader = new StreamReader(stream)) using (var writer = new StreamWriter(stream)) using (var parser = new ChoManifoldWriter(writer)) { parser.Write(records); writer.Flush(); stream.Position = 0; return(reader.ReadToEnd()); } }
public static string ToTextAll(IEnumerable records, TraceSwitch traceSwitch = null) { using (var stream = new MemoryStream()) using (var reader = new StreamReader(stream)) using (var writer = new StreamWriter(stream)) using (var parser = new ChoManifoldWriter(writer) { TraceSwitch = traceSwitch == null ? ChoETLFramework.TraceSwitch : traceSwitch }) { parser.Write(records); writer.Flush(); stream.Position = 0; return(reader.ReadToEnd()); } }