New to Telerik UI for WPFStart a free 30-day trial

ViewModel that represents a time period.

Definition

Constructors

Initializes a new instance of the PeriodSpan class.

C#
public PeriodSpan(DateTime start, TimeSpan span)
Parameters:startDateTime

The start of the time interval.

spanTimeSpan

The TimeSpan of the time period.

Properties

Gets the end of the time period.

C#
public DateTime EndDate { get; }
Property Value:

The end of the time period.

Implements: IPeriodSpan.EndDate

Gets the span of the time period.

C#
public TimeSpan Interval { get; }
Property Value:

The span of the time period.

Implements: IPeriodSpan.Interval

Gets or sets the label that represents the time period.

C#
public string Label { get; set; }
Property Value:

The label that represents the time period.

Gets the start of the time period.

C#
public DateTime StartDate { get; }
Property Value:

The start of the time period.

Implements: IPeriodSpan.StartDate

Gets the span of the time period in Ticks.

C#
public long Ticks { get; }
Property Value:

The span of the time period in Ticks.

Methods

Compares the current instance with another DateTime and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

C#
public int CompareTo(DateTime other)
Parameters:otherDateTime

A DateTime object to compare with this instance.

Returns:

int

A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter. Zero This object is equal to other. Greater than zero This object is greater than other.

Implements: IComparable<DateTime>.CompareTo(DateTime)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

C#
public int CompareTo(object obj)
Parameters:objobject

An object to compare with this instance.

Returns:

int

A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes obj in the sort order. Zero This instance occurs in the same position in the sort order as obj. Greater than zero This instance follows obj in the sort order.

Exceptions:

ArgumentException

obj is not the same type as this instance.

Implements: IComparable.CompareTo(object)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

C#
public int CompareTo(PeriodSpan other)
Parameters:otherPeriodSpan

A PeriodSpan object to compare with this instance.

Returns:

int

A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter. Zero This object is equal to other. Greater than zero This object is greater than other.

Implements: IComparable<PeriodSpan>.CompareTo(PeriodSpan)

Determines whether the specified object is equal to this instance.

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

The object to compare with this instance.

Returns:

bool

true if the specified object is equal to this instance; otherwise, false.

Overrides: object.Equals(object)

Returns a hash code for this instance.

C#
public override int GetHashCode()
Returns:

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Overrides: object.GetHashCode()

Operators

The inequality operator (!=) returns false if its operands are equal, true otherwise.

C#
public static bool operator !=(PeriodSpan periodSpan1, PeriodSpan periodSpan2)
Parameters:periodSpan1PeriodSpan

The first PeriodSpan operand.

periodSpan2PeriodSpan

The second PeriodSpan operand.

Returns:

bool

false if its operands are equal; otherwise, true.

The "less than" relational operator (<) returns true if the first operand is less than the second, false otherwise.

C#
public static bool operator <(PeriodSpan periodSpan1, PeriodSpan periodSpan2)
Parameters:periodSpan1PeriodSpan

The first PeriodSpan operand.

periodSpan2PeriodSpan

The second PeriodSpan operand.

Returns:

bool

true if the first operand is less than the second; otherwise, false.

The equality operator (==) returns true if its operands refer to the same PeriodSpan object, false otherwise.

C#
public static bool operator ==(PeriodSpan periodSpan1, PeriodSpan periodSpan2)
Parameters:periodSpan1PeriodSpan

The first PeriodSpan operand.

periodSpan2PeriodSpan

The second PeriodSpan operand.

Returns:

bool

true if its operands refer to the same PeriodSpan object; otherwise, false.

The "greater than" relational operator (>) returns true if the first operand is greater than the second, false otherwise.

C#
public static bool operator >(PeriodSpan periodSpan1, PeriodSpan periodSpan2)
Parameters:periodSpan1PeriodSpan

The first PeriodSpan operand.

periodSpan2PeriodSpan

The second PeriodSpan operand.

Returns:

bool

true if the first operand is greater than the second; otherwise, false.