Table of Contents

Class TimeRange

Namespace
DotCompute.Runtime.Services.Performance.Types
Assembly
DotCompute.Runtime.dll

A class that represents time range.

public record TimeRange : IEquatable<TimeRange>
Inheritance
TimeRange
Implements
Inherited Members

Constructors

TimeRange(DateTime, DateTime)

A class that represents time range.

public TimeRange(DateTime Start, DateTime End)

Parameters

Start DateTime

The start time of the range.

End DateTime

The end time of the range.

Properties

Duration

Gets the duration of this time range. Calculates the time span between start and end.

public TimeSpan Duration { get; }

Property Value

TimeSpan

End

The end time of the range.

public DateTime End { get; init; }

Property Value

DateTime

Start

The start time of the range.

public DateTime Start { get; init; }

Property Value

DateTime

Methods

Contains(DateTime)

Determines if a given time falls within this range.

public bool Contains(DateTime time)

Parameters

time DateTime

The time to check.

Returns

bool

True if the time is within the range, false otherwise.

Overlaps(TimeRange)

Determines if this range overlaps with another range.

public bool Overlaps(TimeRange other)

Parameters

other TimeRange

The other time range.

Returns

bool

True if the ranges overlap, false otherwise.