MSDN 关于字符串基础的文章显示了这一点:
string str = "hello";
string nullStr = null;
string emptyStr = "";
string tempStr = str + nullStr; // tempStr = "hello"
bool b = (emptyStr == nullStr);// b = false;
string newStr = emptyStr + nullStr; // creates a new empty string
int len = nullStr.Length; // throws NullReferenceException
为什么不与 null 连接会引发空引用异常?是为了让程序员的生活更轻松,这样他们就不必在连接之前检查 null 了吗?