If you declare a DateTime, then the default value is DateTime.MinValue, and hence you have to check it like this:
DateTime dat = new DateTime();
if (dat==DateTime.MinValue)
{
//unassigned
}
If the DateTime is nullable, well that's a different story:
DateTime? dat = null;
if (!dat.HasValue)
{
//unassigned
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…