ExtensionMethod.NET Home of 876 C#, Visual Basic, F# and Javascript extension methods


Returns true if two date ranges intersect.


public static class DateTimeExtensions
	public static bool Intersects(this DateTime startDate, DateTime endDate, DateTime intersectingStartDate, DateTime intersectingEndDate)
		return (intersectingEndDate >= startDate && intersectingStartDate <= endDate);


bool eventsInterect = eventXStartDate.Intersects(eventXEndDate, eventYStartDate, eventYEndDate);

Author: Walter Quesada

Submitted on: 24 mei 2012

Language: C#

Type: System.DateTime

Views: 11455