判断对象是否为null

Person p=teacher as person;

If (p!=null ) dostring ();

使用这样的方法效率高 

使用 is时 进行两次判断效率低

 

posted @ 2016-05-31 22:21  huihuang88515  阅读(149)  评论(0编辑  收藏  举报