Class AssignmentBaselineCollection

AssignmentBaselineCollection class

Represents a collection of AssignmentBaseline objects.

public class AssignmentBaselineCollection : IList<AssignmentBaseline>

Properties

NameDescription
Count { get; }Gets the number of objects contained in this AssignmentBaselineCollection object.
Item { get; set; }Returns the element at the specified index.
ParentAssignment { get; }Gets the parent ResourceAssignment for this collection.

Methods

NameDescription
Add(AssignmentBaseline)This is the stub implementation of ICollection’s Add method, that only throws NotSupportedException
GetEnumerator()Returns an enumerator for this collection.
Remove(AssignmentBaseline)Removes baseline from this collection.
ToList()Converts the AssignmentBaselineCollection object to a list of AssignmentBaseline objects.

Examples

Shows how to read assignment baselines.

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

// read assignment baseline information
foreach (var assignment in project.ResourceAssignments)
{
    var baselines = assignment.Baselines;
    Console.WriteLine("Count of assignment baselines: " + baselines.Count);
    Console.WriteLine("Parent Assignment: " + baselines.ParentAssignment);
    foreach (var baseline in baselines)
    {
        Console.WriteLine("Baseline Start: " + baseline.Start);
        Console.WriteLine("Baseline Finish: " + baseline.Finish);
    }

    Console.WriteLine();
}

Console.WriteLine("Delete all assignment baselines: ");

// delete assignment baselines
foreach (var assignment in project.ResourceAssignments)
{
    List<AssignmentBaseline> baselines = assignment.Baselines.ToList();
    foreach (var baseline in baselines)
    {
        assignment.Baselines.Remove(baseline);
    }
}

See Also