I have the following class:
public class Membership { public DateTime StartDate { get; set; } public DateTime? EndDate { get; set; } // If null then
A bit late but I couldn't find this pattern anywhere in the answers/comments.
if (startDate1 <= endDate2 && startDate2 <= endDate1) { // Overlaps. }