Share via


Languages.Count Property

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

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

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

Property Value

Type: System.Int32
An integer indicating the number of objects in the collection.

Examples

The following example demonstrates how to use the Count property.

To test this property:

  1. Set a breakpoint in your target application.

  2. Run the target application in the debug mode.

  3. When the application stops on the breakpoint, run the add-in.

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

.NET Framework Security

See Also

Reference

Languages Interface

EnvDTE Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples