I am assigning values to a model. Some of these values can be null. I have tried several methods to handle DBNull values but still getting errors
dPbtbud.Xfer = dataFromFile.Tables[0].Rows[i][j++] == DBNull.Value ?
0.0 :
Convert.ToDouble(dataFromFile.Tables[0].Rows[i][j++]);
Also tried
dPbtbud.Xfer = dataFromFile.Tables[0].Rows[i][j++] is DBNull ?
0.0 :
Convert.ToDouble(dataFromFile.Tables[0].Rows[i][j++]);
Non seem to handle null values