开发者

Does A dataTable.Rows.Count Get Evaluated On Each Loop?

I just wonder if I do something like

for (int i = 0; i < dataTable.Rows.Count; i++)

Does array.Count get revaluated on each iteration?

The reason I ask is becua开发者_StackOverflow中文版se if I delete rows from that datatable will that cause problems?


Yes, it does get evaluated each time, but you really shouldn't be changing the number of elements you are iterating through like that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜