Share via


ProjectItem.FileCount, propriété

Obtient le nombre de fichiers associés à un ProjectItem.

Espace de noms :  EnvDTE
Assembly :  EnvDTE (dans EnvDTE.dll)

Syntaxe

'Déclaration
ReadOnly Property FileCount As Short
    Get
short FileCount { get; }
property short FileCount {
    short get ();
}
abstract FileCount : int16
function get FileCount () : short

Valeur de propriété

Type : System.Int16
Un entier court qui indique le nombre de fichiers a associé à un ProjectItem.

Notes

La plupart des éléments de projet se composent d'un seul fichier, mais certains peuvent en comporter plusieurs, comme les formulaires en Visual Basic qui sont enregistrés à la fois comme des fichiers .frm (texte) et .frx (binaires).

Exemples

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

Sécurité .NET Framework

Voir aussi

Référence

ProjectItem Interface

EnvDTE, espace de noms

Autres ressources

Comment : compiler et exécuter les exemples de code du modèle objet Automation