GetWork

Project.GetWork method

Gets Duration object with the specified Double value and default work format.

public Duration GetWork(double val)
ParameterTypeDescription
valDoublespecified double value.

Return Value

Duration object.

Remarks

This method should be used carefully because it returns different durations depending on Project.WorkFormat setting. For example, GetWork(1.0) will return 1 hour when Project.WorkFormat is TimeUnitType.Hour or 1 day if Project.WorkFormat is TimeUnitType.Day.

Examples

Shows how to get a work with default work format.

var project = new Project(DataDir + "Blank2010.mpp");

Console.WriteLine("Project's work format: " + project.Get(Prj.WorkFormat));

// create a work value with project's default work format
var work = project.GetWork(2);
Console.WriteLine("Work: " + work.TimeSpan);
Console.WriteLine("Time unit: " + work.TimeUnit);

See Also