Share via


Interface LifetimeInformation

Usado para determinar se um objeto foi excluído mas não descartado pelo coletor de lixo.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (em EnvDTE80.dll)

Sintaxe

<GuidAttribute("C8F4F9CC-B7E5-4458-BCE3-E1542468F26B")> _
Public Interface LifetimeInformation

Dim instance As LifetimeInformation
[GuidAttribute("C8F4F9CC-B7E5-4458-BCE3-E1542468F26B")]
public interface LifetimeInformation
[GuidAttribute(L"C8F4F9CC-B7E5-4458-BCE3-E1542468F26B")]
public interface class LifetimeInformation
public interface LifetimeInformation

Comentários

Use a interface de consulta (QI) para LifetimeInformation para determinar se um objeto foi excluído mas ainda não foram descartado pelo coletor de lixo.

Exemplos

Sub TaskItemObjectLifetime(ByVal DTE As DTE2)
    Dim tskItem As TaskItem
    Dim tskItems As EnvDTE.TaskItems
    Dim lifetimeInfo As LifetimeInformation

    tskItems = DTE.ToolWindows.TaskList.TaskItems
    tskItem = tskItems.Add("Category", "SubCategory", "Description", _
      vsTaskPriority.vsTaskPriorityLow, EnvDTE.vsTaskIcon. _
      vsTaskIconUser, True, "", -1, True, True)
    tskItems.ForceItemsToTaskList()
    lifetimeInfo = tskItem
    MsgBox("Has task item been deleted? " & _
      lifetimeInfo.HasBeenDeleted.ToString)
    tskItem.Delete()
    MsgBox("Has task item been deleted? " & _
      lifetimeInfo.HasBeenDeleted.ToString)
End Sub
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);
}

Consulte também

Referência

Membros LifetimeInformation

Namespace EnvDTE80

Outros recursos

Como: Compilar e executar os exemplos de códigos automação modelo de objeto