我是新手,在Console里,想请问如下代码在调用时怎么会报图1的错误,给子类调用的值赋初值后为什么会报图2的错误
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace Welcome
{
    class Window
    {
        public Window[] m_ChildWindow = new Window[5];
        public bool IsHaveChild = false;
        public bool IsActive;
        public Window GetActiveWindow()
        {
            if (IsHaveChild == false)
            {
                IsActive = true;
                Console.WriteLine("\"This\" is:{0}", this);
                return this;
            }
            else
            {
                for (int i = 0; i < 5; i++)
                {
                    if (m_ChildWindow[i].IsActive == true)
                    {
                        Console.WriteLine("ChildWindow[{0}] is:{1}", i,m_ChildWindow);
                        return m_ChildWindow[i];
                    }
                }
            }
            return this;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            Window WinExam = new Window();
            WinExam.IsHaveChild = true;
            WinExam.GetActiveWindow();
            Console.ReadKey();
        }
    }
}using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace Welcome
{
    class Window
    {
        public Window[] m_ChildWindow = new Window[5];
        public bool IsHaveChild = false;
        public bool IsActive;
        public Window GetActiveWindow()
        {
            if (IsHaveChild == false)
            {
                IsActive = true;
                Console.WriteLine("\"This\" is:{0}", this);
                return this;
            }
            else
            {
                for (int i = 0; i < 5; i++)
                {
                    if (m_ChildWindow[i].IsActive == true)
                    {
                        Console.WriteLine("ChildWindow[{0}] is:{1}", i,m_ChildWindow);
                        return m_ChildWindow[i];
                    }
                }
            }
            return this;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            Window WinExam = new Window();
            WinExam.IsHaveChild = true;
            for (int i =0; i<5;i++)
            {
                WinExam.m_ChildWindow[i].IsActive = true;
            }
            WinExam.GetActiveWindow();
            Console.ReadKey();
        }
    }
}