public bool IsMatch(C.Component target)
 {
     if (target == null)
     {
         return(false);
     }
     return(target.GetType().IsAssignableFrom(typeof(C.Leaf)));
 }
        public void Initialize()
        {
            var factory = new C.ComponentFactory();

            corporate = factory.Create <C.Composite>("corporate");          // 1
            factory.Create <C.Leaf>(corporate, "president");                // 2
            factory.Create <C.Leaf>(corporate, "vice president");           // 3
            var sales  = factory.Create <C.Composite>(corporate, "sales");  // 4
            var market = factory.Create <C.Composite>(corporate, "market"); // 5

            factory.Create <C.Leaf>(sales, "joe");                          // 6
            factory.Create <C.Leaf>(sales, "bob");                          // 7
            factory.Create <C.Leaf>(market, "judi");                        // 8
            var branch = factory.Create <C.Composite>(corporate, "branch"); // 9

            factory.Create <C.Leaf>(branch, "manager");                     // 10
            factory.Create <C.Leaf>(branch, "peter");                       // 11
        }