Partager via


Languages.Count Property

Definition

Gets a value indicating the number of objects in the collection.

public:
 property int Count { int get(); };
public:
 property int Count { int get(); };
[System.Runtime.InteropServices.DispId(3)]
public int Count { [System.Runtime.InteropServices.DispId(3)] get; }
[<System.Runtime.InteropServices.DispId(3)>]
[<get: System.Runtime.InteropServices.DispId(3)>]
member this.Count : int
Public ReadOnly Property Count As Integer

Property Value

An integer indicating the number of objects in the collection.

Attributes

Examples

The following example demonstrates how to use the Count property.

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  

Applies to