Beispiel #1
0
        static void Main(string[] args)
        {
            #region Presentation
            Composite root = new Composite("html");
            root.Add(new Leaf("img"));
            root.Add(new Leaf("br"));

            Composite comp = new Composite("div");
            comp.Add(new Leaf("hr"));
            comp.Add(new Leaf("br"));

            root.Add(comp);
            root.Add(new Leaf("img"));

            // Add and remove a leaf
            Leaf leaf = new Leaf("br");
            root.Add(leaf);
            root.Remove(leaf);

            // Recursively display tree
            root.Render(1);

            // Wait for user
            Console.ReadKey();
            #endregion
        }