BaselineCollection class

Represents a collection of Baseline objects.

public class BaselineCollection : IList<Baseline>


Name Description
Count { get; } Gets the number of objects contained in this BaselineCollection object.
Item { get; set; } Returns the element at the specified index.
ParentResource { get; } Gets the parent Resource for this collection.


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


Shows how to work with baseline collections.

var project = new Project(DataDir + "WorkWithBaselineCollection.mpp");
var resource = project.Resources.GetByUid(1);

Console.WriteLine("Count of assignment baselines: " + resource.Baselines.Count);
Console.WriteLine("Parent Resource Name: " + resource.Baselines.ParentResource.Get(Rsc.Name));

// read baseline information
foreach (var baseline in resource.Baselines)
    Console.WriteLine("Baseline Number: " + baseline.BaselineNumber);
    Console.WriteLine("Cost: " + baseline.Cost);
    Console.WriteLine("Work: " + baseline.Work);
    Console.WriteLine("BCWP: " + baseline.Bcwp);
    Console.WriteLine("BCWS: " + baseline.Bcws);

Console.WriteLine("Delete all baselines: ");
List<Baseline> baselines = resource.Baselines.ToList();
foreach (var baseline in baselines)
    Console.WriteLine("Delete baseline with name: " + baseline.BaselineNumber);

See Also