WorkUnit Class

Represents working hours.
Inheritance Hierarchy
SystemObject
  Aspose.TasksWorkUnit

Namespace:  Aspose.Tasks
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 21.10
Syntax
public class WorkUnit

The WorkUnit type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleWorkUnit
Initializes a new instance of the WorkUnit class. Creates new WorkUnit object with the specified From and To dates.
Properties
  NameDescription
Public propertyCode exampleFrom
Gets or sets the From date.
Public propertyCode exampleTo
Gets or sets the To date.
Public propertyCode exampleWorkingHours
Gets or sets the duration of working hours.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
Shows how to work with work unit information.
var project = new Project(DataDir + "Project1.mpp");

var calendar = project.Calendars.GetByUid(1);

// get working hours for specific date
var workUnit = calendar.GetWorkingHours(new DateTime(2020, 4, 8, 8, 0, 0), new DateTime(2020, 4, 9, 17, 0, 0));

Console.WriteLine("From: " + workUnit.From);
Console.WriteLine("To: " + workUnit.To);
Console.WriteLine("Working hours: " + workUnit.WorkingHours);
See Also