Example #1
0
 /// <summary>
 /// Write the content of the <paramref name="writeable"/> to a file specified by a filename and mode.
 /// </summary>
 /// <param name="writeable">The writeable that should be written to the file.</param>
 /// <param name="filename">The name of the output file.</param>
 /// <param name="mode">The mode that specifies how the file should be created.</param>
 public static void Write(this IContextWriteable writeable, string filename, FileMode mode = FileMode.OpenOrCreate)
 {
     using (FileStream fs = File.Open(filename, mode, FileAccess.Write)) {
         writeable.Write(fs);
     }
 }
Example #2
0
 /// <summary>
 /// Writes the content of the <paramref name="writeable"/> to the <paramref name="stream"/> with indent context.
 /// </summary>
 /// <param name="writeable">The writeable that should be written to the <paramref name="stream"/>.</param>
 /// <param name="stream">The target of the <paramref name="writeable"/>.</param>
 public static void Write(this IContextWriteable writeable, Stream stream)
 {
     using (ContextStreamWriter sw = new ContextStreamWriter(stream)) {
         writeable.Write(sw);
     }
 }