Example #1
0
        static bool CheckEven(Component obj)
        {
            if (obj.GetNum() % 2 != 0)
            {
                return(false);
            }

            if (obj.GetChilds() == null)//in case a leaf is last
            {
                if (obj.GetNum() % 2 != 0)
                {
                    return(false);
                }
            }

            foreach (Component c in obj.GetChilds())
            {
                return(CheckEven(c));
            }

            return(true);
        }