-
Notifications
You must be signed in to change notification settings - Fork 86
for element
RobertTheGrey edited this page Jan 12, 2013
·
1 revision
Iterates over a collection
<for each="var x in y">anyXml</for>
Results in C#:
foreach(var x in y)
{
//anyXml-generated-code
}
If the generated code appears to reference symbols named xIndex
, xCount
, xIsFirst
, or xIsLast
the minimum number of local variables needed will also be generated using a pattern similar to the following.
{
int xCount = util_count_of(y);
int xIndex = 0;
bool xIsFirst = true;
foreach(var x in y)
{
bool xIsLast = (xIndex == xCount - 1);
{
//anyXml-generated-code
}
xIsFirst = false;
xIndex++;
}
}
<for each="var x in y" a="b" c="d">anyXml</for>
Results in C#:
foreach(var x in y)
{
a=b;
c=d;
//anyXml-generated-code
}