VSProjectItem.ProjectItem 屬性

取得與指定物件關聯的 ProjectItem 物件。

命名空間:  VSLangProj
組件:  VSLangProj (在 VSLangProj.dll 中)

語法

'宣告
ReadOnly Property ProjectItem As ProjectItem
    Get
ProjectItem ProjectItem { get; }
property ProjectItem^ ProjectItem {
    ProjectItem^ get ();
}
abstract ProjectItem : ProjectItem
function get ProjectItem () : ProjectItem

屬性值

型別:EnvDTE.ProjectItem
傳回 ProjectItem 物件。

範例

Sub PrjItem(ByVal dte As DTE2)
    ' List the name of the first VSProjectItem.
    ' Before running, open a VB or C# application in VS.
    Dim vsPrj As VSProject = _
    CType(dte.Solution.Projects.Item(1).Object, VSProject)
    Dim vsPrjItem As VSProjectItem

    vsPrjItem = CType(dte.Solution.Projects.Item(1) _
    .ProjectItems.Item(1).Object, VSProjectItem)
    MsgBox("Proj Item Name: " & vsPrjItem.ProjectItem.Name)
End Sub
public void PrjItem(DTE2 dte)
{
    // List the name of the first VSProjectItem.
    // Before running, open a VB or C# application in VS.
    VSProject vsPrj = (VSProject)dte.Solution.Projects.Item(1).Object;
    VSProjectItem vsPrjItem;

    vsPrjItem = (VSProjectItem)dte.Solution.Projects.Item(1).
    ProjectItems.Item(1).Object;
    MessageBox.Show("Proj Item Name: " + vsPrjItem.ProjectItem.Name);
}

.NET Framework 安全性

請參閱

參考

VSProjectItem 介面

VSLangProj 命名空間

其他資源

HOW TO:編譯和執行 Automation 物件模型程式碼範例