if ((jointLength < 0) || ((jointLength + 1) < 0) ) { throw new OutOfMemoryException(); } //If this is an empty string, just return. if (jointLength == 0) { return String.Empty; }
第一个If中 or 后面的判断
((jointLength + 1) < 0)
有什么意义呢,难道前面的判断范围不包括后面的吗?
http://referencesource.microsoft.com/#mscorlib/system/string.cs
看看注释吧
//Note that we may not catch all overflows with this check (since we could have wrapped around the 4gb range any number of times and landed back in the positive range.) The input array might be modifed from other threads, so we have to do an overflow check before each append below anyway. Those overflows will get caught down there.
有解释一下不?