C# 代码审核

 

           string xml = "<root><book>8899</book><age></age></root>";    

         XElement root = XElement.Parse(xml);           

    string strBook = root.Element("book").Value;           

    string strAge = root.Element("age").Value; //返回为"",而不是null

 

            DataTable dt = new DataTable();  

           dt.Columns.Add("aa");

           dt.Rows.Add(new object[]{DBNull.Value});  

           string aa = dt.Rows[0][0].ToString();//返回为"",而不是null

 

            byte[] buf = new byte[1024*1024];  

           MemoryStream m = new MemoryStream(); //测试出来,memoryStream会自动释放的   

          for (int i = 0; i < 1024; i++)        

     {             

      m.Write(buf, 0, buf.Length);    

         }

posted on 2017-10-20 11:51  Q&A  阅读(527)  评论(0编辑  收藏  举报