本文介绍了字段扩展方法的要点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
DataRow上的字段扩展方法的点是什么(对于无类型的数据表)?
What is the point of the Field extension method on DataRow (for untyped DataTables)?
这里使用字段或不使用它。
与字段:
myRow.Field<Guid>("myColName")没有字段:
(Guid)myRow["myColName"]我没有看到任何有意义的改进。
I don't see any compelling improvement.
推荐答案扩展方法在两个方向上抽取了 DBNull 的概念 - Field 和 SetField ,用于引用类型和可空值类型。对于不可空值类型,它们是等价的。
The extension methods abstract away the concept of DBNull, in both directions - Field and SetField, for reference types and nullable value types. For non-nullable value types they are equivalent.
更多推荐
字段扩展方法的要点
发布评论