随笔

   Hashtable ht2 = new Hashtable();

ht2["aaa"] = "";
                ht2["bbb"] = null;
                ht2["ccc"] = "11";
                if (ht2 != null && !string.IsNullOrEmpty(ht2["bbb"].ToString()))
                {
                    var cc = ":";
                }

当ht2["bbb"]=null的时候 tostring 会报错  必须写成 if (ht2 != null &&ht2["bbb"]!=null&& !string.IsNullOrEmpty(ht2["bbb"].ToString()))

posted on 2015-06-05 10:32  雪原日暮  阅读(105)  评论(0编辑  收藏  举报