New to Telerik UI for WinForms? Start a free 30-day trial

Represents a time interval defined by two DateTime values.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.Scheduler.dll

Syntax:

C#
[TypeConverter(typeof(DateTimeIntervalConverter))]
public class DateTimeInterval : INotifyPropertyChanged, IEquatable<DateTimeInterval>, ICloneable

Inheritance: objectDateTimeInterval

Implements: ICloneableIEquatable<DateTimeInterval>INotifyPropertyChanged

Constructors

Initializes a new instance of the DateTimeInterval class.

C#
public DateTimeInterval()

Initializes a new instance of the DateTimeInterval class.

C#
public DateTimeInterval(DateTime start, DateTime end)
Parameters:startDateTime

The start of the interval.

endDateTime

The end of the interval.

Initializes a new instance of the DateTimeInterval class.

C#
public DateTimeInterval(DateTime start, TimeSpan duration)
Parameters:startDateTime

The start of the interval.

durationTimeSpan

The duration of the interval.

Properties

Gets or sets the duration of the interval.

C#
[Browsable(false)]
public virtual TimeSpan Duration { get; set; }
Property Value:

The duration of the interval.

Represents an empty DateTimeInterval value.

C#
public static DateTimeInterval Empty { get; }

Gets or sets the end of the interval.

C#
public virtual DateTime End { get; set; }
Property Value:

The end of the interval.

Gets or sets the start the start of the interval.

C#
public virtual DateTime Start { get; set; }
Property Value:

The start the interval.

Methods

Creates a separate interval with the same start and end values.

C#
public virtual DateTimeInterval Clone()
Returns:

DateTimeInterval

A new DateTimeInterval with the same bounds.

Determines whether the specified date is contained in this interval.

C#
public bool Contains(DateTime date)
Parameters:dateDateTime

The date.

Returns:

bool

true if this interval contains the specified date; otherwise, false.

Determines whether this interval contains another interval.

C#
public bool Contains(DateTimeInterval other)
Parameters:otherDateTimeInterval

The other.

Returns:

bool

true if this inerval contains the other interval; otherwise, false.

Determines whether another interval has the same start and end values.

C#
public bool Equals(DateTimeInterval other)
Parameters:otherDateTimeInterval

The interval to compare with this instance.

Returns:

bool

true when both interval bounds match; otherwise, false.

Implements: IEquatable<DateTimeInterval>.Equals(DateTimeInterval)

Determines whether another object is a DateTimeInterval with the same start and end values.

C#
public override bool Equals(object obj)
Parameters:objobject

The object to compare with this interval.

Returns:

bool

true when both interval bounds match; otherwise, false.

Overrides: object.Equals(object)

Returns a hash code derived from the interval's start and end values.

C#
public override int GetHashCode()
Returns:

int

A hash code consistent with Equals(DateTimeInterval).

Overrides: object.GetHashCode()

Determines whether this interval intersects with the specified interval.

C#
public bool IntersectsWith(DateTimeInterval other)
Parameters:otherDateTimeInterval

The other interval.

Returns:

bool

Determines whether this interval intersects with the specified interval.

C#
public bool IntersectsWithGreaterEnd(DateTimeInterval other)
Parameters:otherDateTimeInterval

The other interval.

Returns:

bool

Determines whether the specified DateTimeInterval is null or empty.

C#
public static bool IsNullOrEmpty(DateTimeInterval interval)
Parameters:intervalDateTimeInterval

The interval.

Returns:

bool

true if the specified DateTimeInterval is null or empty; otherwise, false.

Raises PropertyChanged for the specified interval property.

C#
protected virtual void OnPropertyChanged(string propertyName)
Parameters:propertyNamestring

The name of the changed property.

Formats an empty interval as Empty and other intervals as [start - end] using the current culture.

C#
public override string ToString()
Returns:

string

The formatted interval.

Overrides: object.ToString()

Events

Occurs when the interval's Start, End, or Duration changes.

C#
public event PropertyChangedEventHandler PropertyChanged

Implements: INotifyPropertyChanged.PropertyChanged