Add

Add(string)

Adds a new base calendar to this CalendarCollection object and returns added calendar.

public Calendar Add(string name)
ParameterTypeDescription
nameStringCalendar name.

Return Value

Added Calendar object.

Exceptions

exceptioncondition
ArgumentExceptionThrown when calendar name is null.

Examples

Shows how to make a standard calendar.

var project = new Project();

// Define a calendar and make it standard
var calendar = project.Calendars.Add("New Standard Calendar");
Calendar.MakeStandardCalendar(calendar);

project.Save(OutDir + "MakeAStandardCalendar_out.xml", SaveFileFormat.Xml);

See Also


Add(string, Calendar)

Adds a new calendar with specified base calendar to this CalendarCollection object and returns added calendar.

public Calendar Add(string name, Calendar baseCalendar)
ParameterTypeDescription
nameStringSpecified name.
baseCalendarCalendarSpecified base calendar.

Return Value

Added Calendar object.

Examples

Shows how to add new calendars.

var project = new Project();

// new calendars can be added to a project's calendar collection by using the collection's Add overloads.
project.Calendars.Add("Calendar");
var newCalendar = project.Calendars.Add("Parent");
project.Calendars.Add("Child", newCalendar);

foreach (var calendar in project.Calendars)
{
    Console.WriteLine("Calendar Name: " + calendar.Name);
}

See Also