I have the following algorithm which retrieves information in a List
of KeyValuePair
(prices) and write them in a DataRow
. I was wondering if I could achieve the same result without j
.
if (prices != null)
{
for (int i = 8, j=0; j < prices.Count; i+=2, j++)
{
res[i] = prices[j].Value;
res[i+1] = prices[j].Key;
}
}
The ouput is a DataRow
as follow :
res[8] = prices[0].Value
res[9] = prices[0].Key
res[10] = prices[1].Value
res[11] = prices[1].Key
res[12] = prices[2].Value
res[13] = prices[2].Key
etc.