Sdílet prostřednictvím


ProjectItem.FileCount Property

Definition

Gets the number of files associated with a 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

Property Value

A short integer indicating the number of files associated with a ProjectItem.

Attributes

Examples

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

Remarks

Most project items consist of only one file, but some can have more than one, as with forms in Visual Basic that are saved as both .frm (text) and .frx (binary) files.

Applies to