static void Main(string[] args)
        {
            List <Manuscript> manuscripts = new List <Manuscript>();

            // Instantiate the formatters
            IFormatter standardFormatter  = new StandardFormatter();
            IFormatter backwardsFormatter = new BackwardsFormatter();
            IFormatter fancyFormatter     = new FancyFormatter();

            FAQ faq = new FAQ(standardFormatter);

            faq.QuestionAnswers.Add("Question 1", "Hello World");
            faq.QuestionAnswers.Add("Question 2", "May the force be with you");
            faq.QuestionAnswers.Add("Question 3", "Rest in Peace!");
            manuscripts.Add(faq);

            Book book = new Book("New book of patterns", "Raghu", "John Doe", backwardsFormatter);

            manuscripts.Add(book);

            Manuscript paper = new Paper("Design Patterns", "Wiki", "Ravi", "Nothing", fancyFormatter);

            manuscripts.Add(paper);

            foreach (var item in manuscripts)
            {
                item.Print();
            }
        }
        static void Main(string[] args)
        {
            var document          = new List <Manuscript>();
            var fancyFormatter    = new FancyFormatter();
            var standardFormatter = new StandardFormatter();

            var faq = new FAQ(standardFormatter)
            {
                Title = "The Bridge pattern"
            };

            faq.Questions.Add("What is it?", "A design pattern.");
            faq.Questions.Add("When do we use it?", "When you need to separate the abstraction from an implementation.");
            document.Add(faq);

            var book = new Book(fancyFormatter)
            {
                Author = "John Sonemz",
                Title  = "Lots of Patterns",
                Text   = "Blah blah blah"
            };

            document.Add(book);

            foreach (var doc in document)
            {
                doc.Print();
            }
        }
        static void Main(string[] args)
        {
            List<Manuscript> manuscripts = new List<Manuscript>();

            // Instantiate the formatters
            IFormatter standardFormatter = new StandardFormatter();
            IFormatter backwardsFormatter = new BackwardsFormatter();
            IFormatter fancyFormatter = new FancyFormatter();

            FAQ faq = new FAQ(standardFormatter);
            faq.QuestionAnswers.Add("Question 1", "Hello World");
            faq.QuestionAnswers.Add("Question 2", "May the force be with you");
            faq.QuestionAnswers.Add("Question 3", "Rest in Peace!");
            manuscripts.Add(faq);

            Book book = new Book("New book of patterns", "Raghu", "John Doe", backwardsFormatter);
            manuscripts.Add(book);

            Manuscript paper = new Paper("Design Patterns", "Wiki", "Ravi", "Nothing", fancyFormatter);
            manuscripts.Add(paper);

            foreach (var item in manuscripts)
            {
                item.Print();
            }
        }
        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();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            List <Manuscript> documents = new List <Manuscript>();

            var standFormatter = new StandardFormatter();
            var faq            = new FAQ(standFormatter);

            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 seperate an abstraction from an implementation");
            documents.Add(faq);


            var backwardsFormatter = new BackwardsFormatter();
            var book = new Book(backwardsFormatter)
            {
                Title  = "Design Patterns",
                Author = "Adrian Gurnett",
                Text   = "Blah blah blah"
            };

            documents.Add(book);


            var fancyFormatter = new FancyFormatter();
            var paper          = new TermPaper(fancyFormatter)
            {
                Class      = "Design Patterns",
                Student    = "Joe N00b",
                Text       = "Blah blah blah",
                References = "GOF"
            };

            documents.Add(paper);


            foreach (var document in documents)
            {
                document.Print();
            }


            Console.ReadKey();
        }