I have to check whether the first cell in my datarow is a datetime object.I’m doing the following for it.Could you please let me know whether there is a better way to do it?
public bool ShouldProcess(DataRow theRow)
{
try
{
Convert.ToDateTime(theRow[0]);
}
catch (Exception)
{
return false;
}
return true;
}
Thanks,
-M
Have you tried
if (theRow[0] is DateTime)?