Tell me please is this is correct way to check NULL in DataRow if need to return a string
Convert.ToString(row[\"Int64_id\"] ?? \"\")
>
We have created an extension class that helps in these kinds of situations.
public static class DataRowExtensions
{
public static T FieldOrDefault(this DataRow row, string columnName)
{
return row.IsNull(columnName) ? default(T) : row.Field(columnName);
}
}
You can use is as follows:
int id = dataRow.FieldOrDefault("Id");