-
Notifications
You must be signed in to change notification settings - Fork 8
DataSet Extension Methods
OtisInf edited this page Feb 19, 2013
·
1 revision
The following extension methods are defined for types related to the DataSet type. Use the methods in conjunction with the DataSet extension methods first shipped with .NET 3.5.
-
TValue Value<TValue>(string columnName)
Gets the value of the column with the name columnName specified from the DataRow specified, casted to the type TValue. If the value is DBNull.Value, null / Nothing will be returned, if TValue is a nullable value type or a reference type. If the value is DBNull.Value and TValue is a non-nullable value type, the default value for TValue will be returned. Use this method instead of the extension method Field<TValue> Microsoft shipped with .NET 3.5/4.0 if you don't want to receive cast exceptions. Conversions are done using Convert.ChangeType if 'is' fails.