public static void Run() { File file = new File("my-image", ".jpg"); IFileHandler handler = new JpegHandler(); IFileHandler pngHandler = new PngHandler(); IFileHandler pdfHandler = new PdfHandler(); handler.SetNext(pngHandler); pngHandler.SetNext(pdfHandler); handler.Handle(file); }
public static void Run() { File file = new File("my-image", ".pdf"); IFileHandler rootOfChain = new JpegHandler(); IFileHandler pngHandler = new PngHandler(); IFileHandler pdfHandler = new PdfHandler(); rootOfChain.SetNext(pngHandler); pngHandler.SetNext(pdfHandler); rootOfChain.Handle(file); }