How to exit for C#? The answer is break.
The break statement terminates the closest enclosing loop or switch statement in which it appears. Control is passed to the statement that follows the terminated statement.
Example:
for (int j = 0; j < list.Count; j++)
{
if (j==5)
break;
}