namespace RemoveDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                object obj = new Person();

                Person person = (Person)obj;

                if (person != null)
                {
                    //do something.
                }

            }
            catch (InvalidCastException ex)
            {

            }
            catch (Exception ex)
            {

            }
        }

        public class Person
        {

        }

        public class Student
        {

        }
    }
}

posted on 2011-06-14 12:28  tonylx  阅读(214)  评论(0)    收藏  举报