I have the following method:
public override bool IsSatisfiedBy(SourceFile candidate)
{
Console.WriteLine("Check 1: " + One.IsSatisfiedBy(candidate));
Console.WriteLine("Check 2: " + Two.IsSatisfiedBy(candidate));
Console.WriteLine("Check 3: " + Three.IsSatisfiedBy(candidate));
return One.IsSatisfiedBy(candidate) && Two.IsSatisfiedBy(candidate) && Three.IsSatisfiedBy(candidate);
}
If i pass a SourceFile as an argument that not fulfills rule one, then rule two and three aren’t checked. I know that this is the correct way, but I would like to read more about the exact behaviour but I can’t find anything because I don’t know what this behaviour is called 😀
It’s called short-circuit evaluation. In C# it happens for the
&&and||operators.