字段扩展方法的要点

编程入门 行业动态 更新时间:2024-10-20 03:26:26
本文介绍了字段扩展方法的要点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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.

更多推荐

字段扩展方法的要点

本文发布于:2023-11-12 12:09:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581464.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   要点   方法

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!