foreach (var name in parent.names)
{
if name.lastname == null)
{
Violated = true;
this.message = "lastname reqd";
}
if (!Violated)
{
Violated = !(name.firstname == null) ? false : true;
if (ruleViolated)
this.message = "firstname reqd";
}
}
Whenever violated is true, I want to get out of the foreach
loop immediately. How do I do it?