using System; using System.IO; using System.Linq; namespace Developpez.Dotnet.IO { /// /// Fournit des méthodes d'extension pour les TextWriter /// public static class TextWriterExtensions { /// /// Crée un wrapper qui reproduit la sortie d'un TextWriter sur le ou les autres TextWriters spécifiés. /// /// Premier TextWriter /// Second TextWriter /// TextWriters supplémentaires /// Un wrapper qui reproduit la sortie de writer sur les autres TextWriters. public static TextWriter Tee(this TextWriter writer, TextWriter other, params TextWriter[] others) { var outputWriters = new[] { writer, other }.Concat(others).ToArray(); if (outputWriters.Any(w => w == null)) throw new ArgumentNullException(); return new TeeTextWriter(outputWriters); } } }