Share via


ProjectItem.FileCount 属性

获取与关联的文件数ProjectItem

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

语法

声明
ReadOnly Property FileCount As Short
short FileCount { get; }
property short FileCount {
    short get ();
}
abstract FileCount : int16 with get
function get FileCount () : short

属性值

类型:Int16
短整数,指示与关联的文件的数目ProjectItem

备注

大多数项目项包含只有一个文件,但一些可以具有多个与中的窗体一样Visual Basic,将另存为.frm (文本) 和.frx (二进制) 文件。

示例

Sub FileCountExample(ByVal dte As DTE2)

    ' Before running this example, open a project.

    Dim proj As Project = dte.Solution.Projects.Item(1)
    Dim item As ProjectItem
    Dim items As String

    For Each item In proj.ProjectItems
        items &= "    " & item.Name & " (FileCount = " & _
            item.FileCount & ")" & vbCrLf
    Next

    MsgBox(proj.Name & " has the following project items:" & _
        vbCrLf & vbCrLf & items)

End Sub
public void FileCountExample(DTE2 dte)
{
    // Before running this example, open a project.

    Project proj = dte.Solution.Projects.Item(1);
    string items = "";

    foreach (ProjectItem item in proj.ProjectItems)
        items += "    " + item.Name + " (FileCount = " + 
            item.FileCount + ")\n";

    MessageBox.Show(proj.Name + 
        " has the following project items:\n\n" + items);
}

.NET Framework 安全性

请参阅

参考

ProjectItem 接口

EnvDTE 命名空间

其他资源

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