class Program
{
static void Main(string[] args)
{
bool success = true;
int[] array = { 10, 15, 20 };
foreach (var i in array)
success = success && SynchronizeAccount(i);
}
static bool SynchronizeAccount(int i)
{
Console.WriteLine(i);
return false;
}
}
Output is 10. After first step 'success' becomes false and never will be true, so c# stops loop execution after first iteration. But I need SIDE effect of SynchronizeAccount, not 'success' value.