This documentation is archived and is not being maintained.

LifetimeInformation Interface 

Used to determine if an object has been deleted but not discarded by the garbage collector.

Namespace: EnvDTE80
Assembly: EnvDTE80 (in envdte80.dll)

[GuidAttribute("C8F4F9CC-B7E5-4458-BCE3-E1542468F26B")] 
public interface LifetimeInformation
/** @attribute GuidAttribute("C8F4F9CC-B7E5-4458-BCE3-E1542468F26B") */ 
public interface LifetimeInformation
GuidAttribute("C8F4F9CC-B7E5-4458-BCE3-E1542468F26B") 
public interface LifetimeInformation

Use query interface (QI) for LifetimeInformation to determine whether an object has been deleted but not yet discarded by the garbage collector.

public void TaskItemObjectLifetime(DTE2 DTE)
{
    TaskItem tskItem;
    EnvDTE.TaskItems tskItems;
    LifetimeInformation lifetimeInfo;

    tskItems = DTE.ToolWindows.TaskList.TaskItems;
    tskItem = tskItems.Add("Category", "SubCategory", "Description", 
      vsTaskPriority.vsTaskPriorityLow, 
      EnvDTE.vsTaskIcon.vsTaskIconUser, true, "", -1, true, true);
    tskItems.ForceItemsToTaskList();
    lifetimeInfo = (LifetimeInformation)tskItem;
    MessageBox.Show("Has task item been deleted? " + 
      lifetimeInfo.HasBeenDeleted);
    tskItem.Delete();
    MessageBox.Show("Has task item been deleted? " +  
      lifetimeInfo.HasBeenDeleted);
}
Show: