I have a datarow that has an integer in one of the columns. However the following code does not evaluate as true. I'm having a hard time understanding why. What am I missing?
foreach (DataRow dr in dataset.Tables[0].Rows)
{
//this evaluates as false, even when I have a valid castable INT value in the column (as an object).
if (dr[3] is int)
{
if (Convert.ToInt32(dr[3]) == 3)
{
//do something with row
}
else if (Convert.ToInt32(dr[3]) == 4)
{
//do someting else with row
}
}
}