Class WorkingTime

Class WorkingTime

Namespace: Aspose.Tasks
Assembly: Aspose.Tasks.dll (25.2.0)

Represents a working time during a weekday.

[ClassInterface(ClassInterfaceType.AutoDual)]
public class WorkingTime

Inheritance

objectWorkingTime

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

WorkingTime(DateTime, DateTime)

Initializes a new instance of the Aspose.Tasks.WorkingTime class with a interval with the specified start and finish times.

public WorkingTime(DateTime fromTime, DateTime toTime)

Parameters

fromTime DateTime

interval start time

toTime DateTime

interval end time

WorkingTime(TimeSpan, TimeSpan)

Initializes a new instance of the Aspose.Tasks.WorkingTime class with an interval item with the specified start and finish times.

public WorkingTime(TimeSpan fromTime, TimeSpan toTime)

Parameters

fromTime TimeSpan

Interval’s start time represented by System.TimeSpan struct.

toTime TimeSpan

Interval’s end time represented by System.TimeSpan struct.

Examples

The overload of WorkingTime ctor can be used to initialize interval’s start and end using TimeSpans:

csharp
[C#]
var wt = new WorkingTime(new TimeSpan(9, 0, 0), new TimeSpan(18, 0, 0));

Exceptions

ArgumentException

When toTime less than of equal to toTime argument or when interval between fromTime and toTime is greater than 24 hours.

WorkingTime(int, int)

Initializes a new instance of the Aspose.Tasks.WorkingTime class with an interval item with the specified start and finish times.

public WorkingTime(int fromHours, int toHours)

Parameters

fromHours int

Interval’s start time represented by whole number of hours (0-24).

toHours int

Interval’s end time represented by whole number of hours (0-24).

Examples

The overload of WorkingTime ctor can be used to initialize interval’s start and end using whole hours:

csharp
[C#]
var wt = new WorkingTime(9, 13);

Exceptions

ArgumentException

When toTime less than of equal to toTime argument or when interval between fromTime and toTime is greater than 24 hours.

Properties

From

Gets the beginning of a working time.

public DateTime From { get; }

Property Value

DateTime

To

Gets the end of a working time.

public DateTime To { get; }

Property Value

DateTime

Methods

Equals(object)

Checks that the objects are equal.

public override bool Equals(object obj)

Parameters

obj object

Second object to compare.

Returns

bool

True if the objects are equal, false otherwise.

GetHashCode()

Returns a hash code value for the instance of the Aspose.Tasks.WorkingTime class.

public override int GetHashCode()

Returns

int

returns a hash code value for this object.