I've been digging through ExpressionVisitor
in .NET
and I found this for
loop,
for (int i = 0, n = nodes.Count; i < n; i++)
{
Expression node = Visit(nodes[i]);
if (newNodes != null)
{
newNodes[i] = node;
}
else if (!object.ReferenceEquals(node, nodes[i]))
{
newNodes = new Expression[n];
for (int j = 0; j < i; j++)
{
newNodes[j] = nodes[j];
}
newNodes[i] = node;
}
}
Now is there any particular reason why is that: i = 0, n = nodes.Count; i < n
?
Is there any performance gain from this that is not in i = 0; i < nodes.Count
?