【发布时间】:2017-12-11 08:24:45
【问题描述】:
这是我的代码。
for (int i = 1; i < dataGridView2.RowCount - 1; i++)
{
int valueCellIndex = 3;//assume calculate the 0th column
int resultCellIndex = 4;//assume result to put into the 1th column
var lastRow = dataGridView2.Rows[i - 1];
var curRow = dataGridView2.Rows[i];
double last = Convert.ToInt32(lastRow.Cells[valueCellIndex].Value);
double cur = Convert.ToInt32(curRow.Cells[valueCellIndex].Value);
gain = Convert.ToInt32(curRow.Cells[resultCellIndex].Value = cur - last); //
}
JsonArray.Add(new JsonInput(close, gain));
如何让 for 循环中的“增益”进入 JsonArray ?
【问题讨论】:
-
在for循环上方声明一个数组,并在for循环内的数组中添加元素
标签: c# for-loop datagridview