Class TaskCollection

Class TaskCollection

Namespace: Aspose.Tasks
Assembly: Aspose.Tasks.dll (25.2.0)

Represents a collection of Aspose.Tasks.Task objects.

public class TaskCollection : IList<task>, ICollection<task>, IEnumerable<task>, IEnumerable

Inheritance

objectTaskCollection

Implements

IList<task>, ICollection<task>, IEnumerable<task>, IEnumerable

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Properties

Count

Gets the number of objects contained in the TaskCollection.

public int Count { get; }

Property Value

int

IsReadOnly

Gets a value indicating whether this collection is read only.

public bool IsReadOnly { get; }

Property Value

bool

ParentProject

Gets the parent project of the TaskCollection object.

public Project ParentProject { get; }

Property Value

Project

this[int]

Returns the element at the specified index.

public Task this[int index] { get; set; }

Property Value

Task

Methods

Add(Task)

Add the specified task to the instance of the Aspose.Tasks.TaskCollection class. If ParentProject.CalculationMode is None user should invoke Project.Recalculate() after using this method (It will reschedule all project tasks (start/finish dates, sets early/late dates) and calculate the dependent fields such as slacks, work and cost fields, ids and outline levels). If ParentProject.CalculationMode is Manual the method will calculate only task id, outline level and outline numbers automatically. If ParentProject.CalculationMode is Automatic the method reschedules all project’s tasks automatically (start/finish dates, sets early/late dates, calculates slacks, work and cost fields, recalculates ids and outline levels).

public void Add(Task item)

Parameters

item Task

the specified task which should be added to this task collection.

Add()

Adds new task to project tasks collection on the same outline level of the last task.

public Task Add()

Returns

Task

returns the newly added instance of the Aspose.Tasks.Task class.

Add(string)

Adds a new task to children tasks collection.

public Task Add(string taskName)

Parameters

taskName string

the specified task name.

Returns

Task

returns the newly added instance of the Aspose.Tasks.Task class.

Add(string, int)

Adds a new recurring task to children tasks collection.

public Task Add(string taskName, int beforeTaskId)

Parameters

taskName string

the specified task name.

beforeTaskId int

The specified id of a task before which a new task will be inserted.

Returns

Task

returns a task which was inserted before a task with the specified id.

Exceptions

ArgumentOutOfRangeException

ArgumentOutOfRangeException is thrown if the specified id is not a valid task id.

Add(RecurringTaskParameters)

Inserts a new task before a task with the specified id and on the same outline level.

public Task Add(RecurringTaskParameters parameters)

Parameters

parameters RecurringTaskParameters

The parameters the specified parameters for creation of recurring task.

Returns

Task

returns the newly added instance of the Aspose.Tasks.Task class.

Exceptions

ArgumentNullException

Thrown if the specified parameters are null.

ArgumentException

Thrown if the specified parameters are invalid.

Contains(Task)

Checks if collection contains specified item.

public bool Contains(Task item)

Parameters

item Task

The item to check.

Returns

bool

true, if collection contains an item, false otherwise.

GetById(int)

Returns a task with the specified Id whose ancestor is parent task of this collection .

public Task GetById(int id)

Parameters

id int

TaskEntity Id

Returns

Task

returns the instance of Aspose.Tasks.Task class with the specified id whose ancestor is parent task of this collection.

GetByUid(int)

Returns a task with the specified Uid whose ancestor is parent task of this collection .

public Task GetByUid(int uid)

Parameters

uid int

TaskEntity Uid.

Returns

Task

returns the instance of Aspose.Tasks.Task class with the specified uid whose ancestor is parent task of this collection.

GetEnumerator()

Returns an enumerator for this collection.

public IEnumerator<task> GetEnumerator()

Returns

IEnumerator<Task&gt;

an enumerator for this collection.

Insert(int, Task)

This is the stub implementation of IList’s Insert method, that only throws NotSupportedException

public void Insert(int index, Task item)

Parameters

index int

The index to insert at.

item Task

The item to insert.

Remove(Task)

This is the stub implementation of ICollection’s Remove method, that only throws NotSupportedException

public bool Remove(Task item)

Parameters

item Task

The item to remove.

Returns

bool

true if the item was removed; false otherwise.

ToList()

Converts the TaskCollection object to a list of Aspose.Tasks.Task objects.

public List<task> ToList()

Returns

List<Task&gt;

returns a list which contains the Aspose.Tasks.Task class instances of this collection. </task></task></task>