Example #1
0
 public static void Print(this Printers.Printer printer, string[] text)
 {
     for (int i = 0; i < text.Length; i++)
     {
         printer.Print(text[i]);
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            ColorPrinter colorPrinter = new ColorPrinter();

            colorPrinter.Print("Who am I? ");
            colorPrinter.Print("\nPrinting in blue  ", ConsoleColor.Blue);
            PhotoPrinter photoPrinter = new PhotoPrinter();
            Photo        waterfall    = new Photo("Waterfall", 1024);

            photoPrinter.Print(waterfall);
            photoPrinter.Print("Who am I? ");
            Printer printer = colorPrinter;

            printer.Print("I am used as base now!)");
            printer = photoPrinter;
            printer.Print("I am used as base now!)");

            printer = new Printer();
            printer.Print("I am base now!)");
            Console.ReadLine();
        }