Proprietà Languages.Count

Ottiene un valore che indica il numero di oggetti nell'insieme.

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

Sintassi

'Dichiarazione
ReadOnly Property Count As Integer
    Get
int Count { get; }
property int Count {
    int get ();
}
abstract Count : int
function get Count () : int

Valore proprietà

Tipo: System.Int32
Intero che indica il numero di oggetti nell'insieme.

Esempi

Nell'esempio riportato di seguito viene illustrato come utilizzare la proprietà Count.

Per verificare la proprietà:

  1. Impostare un punto di interruzione nell'applicazione di destinazione.

  2. Eseguire l'applicazione di destinazione in modalità di debug.

  3. Quando l'applicazione si interrompe in corrispondenza del punto di interruzione, eseguire il componente aggiuntivo.

public static void Count(DTE dte)
{
    // Setup debug Output window.
    Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Count Property Test");
    owp.Activate();

    EnvDTE.Languages languages = dte.Debugger.Languages;
    owp.OutputString("Number of items in the language collection is " + 
                     languages.Count + ": ");
    foreach(EnvDTE.Language lang in languages)
        owp.OutputString(lang.Name + "  ");
}
Shared Sub Count(ByRef dte As EnvDTE.DTE)
    Dim languages As EnvDTE.Languages = dte.Debugger.Languages
    Dim str As String = vbCrLf
    str = "There are " + languages.Count.ToString()
    str += " items in the language collection: "
    For Each lang As EnvDTE.Language In languages
        str += lang.Name + "  "
    Next
    MessageBox.Show(str, "Language Test - Count Property")
End Sub

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Languages Interfaccia

Spazio dei nomi EnvDTE

Altre risorse

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