(开发篇) null判断~ .net判断一个对象是否为空的方法(未完待续)

方法1~ !string.IsNullOrEmpty()

1 if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.QueryString["id"]))
2 {
3     Convert.ToInt32(Request.QueryString["id"]);
4 } 

方法2~ try{} catch{}

1 try
2 {
3     model_weekplandetails.constructiion_complete_time = DateTime.Parse(ds.Tables[0].Rows[i]["constructiion_complete_time"].ToString());
4 }
5 catch { }

未完待续,欢迎补充~

原文地址:https://www.cnblogs.com/phoenixfling/p/2495243.html