Condividi tramite


Proprietà ProjectItem.FileCount

Ottiene il numero di file associato a un oggetto ProjectItem.

Spazio dei nomi:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Sintassi

'Dichiarazione
ReadOnly Property FileCount As Short
short FileCount { get; }
property short FileCount {
    short get ();
}
abstract FileCount : int16
function get FileCount () : short

Valore proprietà

Tipo: System.Int16
Un valore short Integer che indica il numero dei file associati a un oggetto ProjectItem.

Note

La maggior parte degli elementi di progetto sono costituiti da un file, ma alcuni possono avere più di uno, come con i form in Visual Basic che viene salvato come sia .frm (testo) che file di .frx (binario).

Esempi

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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

ProjectItem Interfaccia

Spazio dei nomi EnvDTE

Altre risorse

Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione