I was wondering what happens when a program processes an if-structure with multiple conditions. I have an idea, but I'm not sure about it. I'll give an example:
List<string> myTestList = null;
if (myTestList != null && myTestList.Count > 0)
{
//process
}
The list is null. When processing the if statement, will it go from left to right exiting the if as soon as one condition is false?
I've tried it and seems to throw no errors, so I assume the above explains it, but I'm not sure.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…