Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
DataRow (型指定されていない DataTable の場合)のField拡張メソッドのポイントは何ですか?
Fieldを使用する場合と使用しない場合の比較を次に示します。
フィールド付き:
myRow.Field<Guid>("myColName")
フィールドなし:
(Guid)myRow["myColName"]
目立った改善は見られません。
拡張メソッドは、参照型と null 許容値型の との概念をDBNull両方向に抽象化します。null 非許容値型の場合、それらは同等です。FieldSetField
DBNull
Field
SetField
拡張メソッドは、null 許容型をサポートしています。例えば:
myRow.Field<Guid?>("myColName")