Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.44 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Linq statement returns null
  2. EmployeeLog objEmpployeeLog =
  3.              lstEmployeeLog.Where(x => x.EmpId == iEmpId
  4.                     && x.InDateTime.Value == lastCheckInDate
  5.                     && x.OutDateTime == null).FirstOrDefault();
  6.        
  7. var epsilon = TimeSpan.FromSeconds(1.0);
  8. var logItem = employeeLog.Where(x => x.EmpId == empId
  9.     && (x.InDateTime.Value - lastCheckInDate) < epsilon
  10.     && x.OutDateTime == null).FirstOrDefault();