VSProjectItem.ProjectItem 属性

更新:2007 年 11 月

获取与给定对象关联的 ProjectItem 对象。

命名空间:  VSLangProj
程序集:  VSLangProj(在 VSLangProj.dll 中)

语法

声明
ReadOnly Property ProjectItem As ProjectItem
用法
Dim instance As VSProjectItem
Dim value As ProjectItem

value = instance.ProjectItem
ProjectItem ProjectItem { get; }
property ProjectItem^ ProjectItem {
    ProjectItem^ get ();
}
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);
}

权限

另请参见

参考

VSProjectItem 接口

VSProjectItem 成员

VSLangProj 命名空间

其他资源

如何:编译和运行自动化对象模型代码示例