static void Main(string[] args)
        {
            var documents         = new List <Manuscript>();
            var standardFormatter = new StandardFormatter();
            var reverseFormatter  = new ReverseFormatter();
            var fancyFormatter    = new FancyFormatter();

            var faq = new FAQ(standardFormatter);

            faq.Title = "The Bridge Pattern FAQ";
            faq.Questions.Add("What is it?", "A design pattern.");
            faq.Questions.Add("When do we use it?", "When you need to separate an abstraction from an implementation.");
            documents.Add(faq);

            var book = new Book(fancyFormatter)
            {
                Title  = "Lots of patterns",
                Author = "John Sonmez",
                Text   = "Blah Blah Blah..."
            };

            documents.Add(book);
            var paper = new TermPaper(reverseFormatter)
            {
                Class      = "Design Patterns",
                Student    = "Joe N00b",
                Text       = "Blah Blah Blah...",
                References = "GOF"
            };

            documents.Add(paper);

            documents.ForEach(m => m.Print());
            ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            List <Docuent> documents         = new List <Docuent>();
            IFormatter     standardFormatter = new ReverseFormatter();
            var            faq = new FAQ(standardFormatter)
            {
                Title = "The Bridge Pattern FAQ",
            };

            faq.Question.Add("What is it?", "A design pattern");
            faq.Question.Add("When to use", "When we want to seprate abstarction from implementaion");

            var book = new Book(standardFormatter)
            {
                Author = "abc",
                Title  = "abc",
                Text   = "blah blah blah"
            };

            var paper = new TermPaper(standardFormatter)
            {
                Class      = "Nursery",
                References = "No reference",
                Student    = "I am the student",
                Text       = "Bridge pattern"
            };

            documents.Add(faq);
            documents.Add(book);
            documents.Add(paper);

            foreach (var document in documents)
            {
                document.Display();
                Console.WriteLine();
            }
            Console.ReadLine();
        }