Assuming StartDate and EndDate are of type DateTime:

(EndDate - StartDate).TotalDays