LifetimeInformation 介面
用來判斷記憶體回收行程是否尚未捨棄已遭到刪除的物件。
命名空間: EnvDTE80
組件: EnvDTE80 (在 EnvDTE80.dll 中)
語法
'宣告
<GuidAttribute("C8F4F9CC-B7E5-4458-BCE3-E1542468F26B")> _
Public Interface LifetimeInformation
[GuidAttribute("C8F4F9CC-B7E5-4458-BCE3-E1542468F26B")]
public interface LifetimeInformation
[GuidAttribute(L"C8F4F9CC-B7E5-4458-BCE3-E1542468F26B")]
public interface class LifetimeInformation
[<GuidAttribute("C8F4F9CC-B7E5-4458-BCE3-E1542468F26B")>]
type LifetimeInformation = interface end
public interface LifetimeInformation
LifetimeInformation 型別會公開下列成員。
屬性
名稱 | 說明 | |
---|---|---|
HasBeenDeleted | 取得值,指出記憶體回收行程是否尚未捨棄已遭到刪除的物件。 |
回頁首
備註
請使用 LifetimeInformation 的查詢介面 (QI),判斷記憶體回收行程是否尚未捨棄已遭到刪除的物件。
範例
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);
}