Share via


TaskListCollection Constructors

Definition

Initializes a new instance of the TaskListCollection class.

Overloads

TaskListCollection()

Initializes a new instance of the TaskListCollection class.

TaskListCollection(ICollection)

Initializes a new instance of the TaskListCollection class with the specified task list element.

TaskListCollection()

Initializes a new instance of the TaskListCollection class.

public:
 TaskListCollection();
public TaskListCollection ();
Public Sub New ()

Examples

The following example derives the custom class myHierarchyInfoTaskList from the TaskList class. The class member _taskList is instantiated the first time the Tasks property is implemented. _taskList is then added to the TaskListCollection object and returned.

public override TaskListCollection Tasks {
    get {
        TaskListCollection taskListCol = new TaskListCollection();
        if (_taskList == null) {
            _taskList = new myHierarchyInfoTaskList(this);
        }

        taskListCol.Add(_taskList);

        return taskListCol;
    }
}

Applies to

TaskListCollection(ICollection)

Initializes a new instance of the TaskListCollection class with the specified task list element.

public:
 TaskListCollection(System::Collections::ICollection ^ taskLists);
public TaskListCollection (System.Collections.ICollection taskLists);
new Microsoft.Web.Management.Client.TaskListCollection : System.Collections.ICollection -> Microsoft.Web.Management.Client.TaskListCollection
Public Sub New (taskLists As ICollection)

Parameters

taskLists
ICollection

The TaskList object to be added to the TaskListCollection object.

Examples

The following example creates a new TaskListCollection object and displays the name and modified state of each item in the collection.

public void tTask() {

    TaskListCollection tlc = new TaskListCollection(Tasks);

    Trace.WriteLine("preferred listing of tasks from TaskListCollection");
    foreach (TaskList tl in tlc)
        Trace.WriteLine(tl.ToString() + "  IsDirty " +
          tl.IsDirty);

    Trace.WriteLine("\n Get Item approach");
    for (int i = 0; i < tlc.Count; i++)
        Trace.WriteLine(tlc[i].ToString() + "  IsDirty " +
            tlc[i].IsDirty);

}

Remarks

To create a new TaskListCollection object, you should generally use the TaskListCollection() overload, which does not have a parameter.

Applies to