浅谈类型转换操作符is/as

2019-05-20 12:38:46王冬梅

    {
        object o = new object();
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write(o.GetType());//System.Object
            if ((o as System.Object)!=null)  //执行第1次类型兼容检查,o is A 返回false
            {
                Response.Write("o is System.Object");
            }
        }
    }

}