C# - Does function get called for each iteration of a foreach loop?
- by Robert W
If I have functionality like the following - will ReturnParts() get called for each iteration in a foreach loop, or will it get called just the once?
private void PrintParts()
{
foreach(string part in ReturnParts())
{
// Do Something or other.
}
}
private string[] ReturnParts()
{
// Build up and return an array.
}