ProjectItem.FileCount 属性

定义

获取与关联的文件的数目 ProjectItem

public:
 property short FileCount { short get(); };
public:
 property short FileCount { short get(); };
[System.Runtime.InteropServices.DispId(13)]
public short FileCount { [System.Runtime.InteropServices.DispId(13)] get; }
[<System.Runtime.InteropServices.DispId(13)>]
[<get: System.Runtime.InteropServices.DispId(13)>]
member this.FileCount : int16
Public ReadOnly Property FileCount As Short

属性值

Int16

一个短整数,指示与关联的文件数 ProjectItem

属性

示例

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);  
}  

注解

大多数项目项仅由一个文件组成,但某些项目项可以有多个文件,因为中的窗体 Visual Basic 既保存为 inline.frm (文本) frx (二进制) 文件。

适用于