TaskList Constructor

Definition

Initializes a new instance of the TaskList class.

protected:
 TaskList();
protected TaskList ();
Protected Sub New ()

Examples

The following example shows an overridden Tasks method that is called by a private member of the HierarchyProvider class when the shortcut menu is activated on the node.

internal class DemoHierProvidr : HierarchyProvider
{

    private DemoHierarchyInfo _info;
    public DemoHierProvidr(IServiceProvider serviceProvider)
        : base(serviceProvider)
    {
    }
internal class DemoHierarchyInfo : HierarchyInfo
{

    private static string sMachine = "Machine";
    private static string sOS = "OSVersion";
    static string sPerformance = "Performance";
    private static string sDemoCat = sPerformance; // "DemoCategory";
    private static string sUDemoH = "UltraDemo";
    private System.Collections.IDictionary _dhDict;
    private string _sNodeName;
    private bool _navSimp = false;
    private System.IO.FileStream _objStrm;

    HierarchyDemoInfoTaskList _dhTaskList;
public override TaskListCollection Tasks
{
    get
    {
        TaskListCollection tlc = base.Tasks;

        if (_dhTaskList == null)
        {
            _dhTaskList = new HierarchyDemoInfoTaskList(this);
        }
        tlc.Insert(0, _dhTaskList);

        return tlc;
    }
}
private sealed class HierarchyDemoInfoTaskList : TaskList
{
    private DemoHierarchyInfo _owner;
    private bool _dirtyState = false;
    Person _curPerson = new Person(23, "Albert", "Smith");

    public HierarchyDemoInfoTaskList(DemoHierarchyInfo owner) {
        _owner = owner;
    }

    public void Delete()
    {
        _owner.Delete();
    }

Remarks

The constructor is often called indirectly by a containing class that implements the IServiceProvider interface.

Applies to