Mã nào là mã đúng nhất?Cách nào là đúng để kiểm tra ngoại lệ Null?
if (HttpContext.Current.Response.Cookies[authCookieName] != null) {
HttpContext.Current.Response.Cookies[authCookieName].Value = "New Value";
}
hoặc
if (HttpContext.Current != null)
if (HttpContext.Current.Response != null)
if (HttpContext.Current.Response.Cookies != null)
if (HttpContext.Current.Response.Cookies[authCookieName] != null)
HttpContext.Current.Response.Cookies[authCookieName].Value = "New Value";
BTW: HttpContext là một lớp học. Nếu một lớp là null, bạn chắc chắn gặp rắc rối! : P – yfeldblum
câu hỏi lừa .... drat! – craigmoliver