Hi,
I have a foreach block where I want to plot out for trace-debug purposes the index of the step inside the foreach. As a C# newbie I do it as follows:
int i = 1;
foreach (x in y)
{
... do something ...
WriteDebug("Step: "+i.ToString());
i++;
}
I wondered if there's any way to get the value of the current step's index without explicitly creating a variable for that purpose.
EDIT: To clarify, I'm obviously familiar with the option of a for loop, however it's not an array I'm going through but rather an unordered collection. The reason for the numbering is just for the purpose of showing progress in the debug level and nothing else.
Thanks