从数据库中取出DateTime类型的值是,判断是否空???
解决方案:
DateTime不可能为null和空 DateTime dt= new DateTime(); 其实是有值的。是0001年1月1日
if( CreaTime==DateTime.MinValue)
{
return true;
}
else{
return false;
}
本文介绍了一种判断DateTime类型值是否为最小值(即0001年1月1日)的方法,通过比较变量与DateTime.MinValue来实现,这在.NET框架中是检查日期是否为空或无效的有效方式。
从数据库中取出DateTime类型的值是,判断是否空???
解决方案:
DateTime不可能为null和空 DateTime dt= new DateTime(); 其实是有值的。是0001年1月1日
if( CreaTime==DateTime.MinValue)
{
return true;
}
else{
return false;
}

被折叠的 条评论
为什么被折叠?