场景逻辑所需的帮助 [英] Help needed with the logic of a scenerio
本文介绍了场景逻辑所需的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!!!
我有一个数据表,其内容与
Hi!!!
I have a data-table whose content are as
FnYear || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12
2001-2002 || 8 || 8 || 8 || 8 || 8 || 8 || 9 || 9 || 9 || 9 || 9 || 9
2002-2003 || 8 || 8 || 8 || 8 || 8 || 8 || 8 || 8 || 8 || 8.60 || 8.60 || 8.60
How to find when the value is changing in the datarow ?
推荐答案
嗯,我错过了什么吗?这似乎微不足道.
Uh, am I missing something? This seems trivial.
int GetChangeIndex(DataRow row){
double value = double.Parse(row.Cells[0].Value);
for(int i = 1; i < row.Cells.Length; i++){
double thiscell = double.Parse(row.Cells[i].Value);
if(value != thiscell) return i;
else value = thiscell;
}
return -1; // no change; you could also return
// row.Cells.Length, or throw an exception
}
这篇关于场景逻辑所需的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文