嗨我有一个案例,我只想比较日期时间对象的日期。如何在不将其转换为字符串的情况下实现它。
public bool CheckSendEmailWithinCalendarDay(UnifiedUser user, string messageId, DateTime whenSent) { var result = _ctx.UserSpecificMessageHistories .Where(u => u.UserId == user.User.UserId) .Where(d => d.WhenSent.Date == whenSent.Date) .FirstOrDefault(m => m.EmailTemplate.Id == messageId); return Convert.ToBoolean(result); }
答案 0 :(得分:3)