【发布时间】:2017-07-19 03:31:49
【问题描述】:
UltraGrid dgSomeGrid = new UltraGrid();
if (((someDS.someDT)dgSomeGrid.DataSource).Any(x => x.ColumnA == someCode))
{
}
上面的代码抛出异常,因为其中一行被删除,与之前发布的类似问题:Error: Deleted row information cannot be accessed through the row。
根据答案,解决方案可以检查 rowVersion 所以我想知道如何将DataRowVersion.Original 应用于上述Lambda 表达式而不是循环?
【问题讨论】:
-
你试过
...Any(x => x["ColumnA",DataRowVersion.Original]==someCode)) -
@Pikoh
Possible unintended reference comparison; to get a value comparison, cast the left hand side to type string? -
试过但没有运气
....Any(x => Convert.ToString(x["ColumnA", DataRowVersion.Original].ToString()) == someCode) -
这段代码会发生什么?