public static string GetString(this ITextWritable @this) { using (var writer = new StringWriter()) { @this.Write(writer); return(writer.ToString()); } }
public static void WriteToFile(this ITextWritable @this, FileInfo file) { using (var stream = file.OpenWrite()) using (var writer = new StreamWriter(stream)) { stream.SetLength(0); @this.Write(writer); } }