Share via


Commands2.Count Property

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

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

Syntax

'Declaration
ReadOnly Property Count As Integer
'Usage
Dim instance As Commands2 
Dim value As Integer 

value = instance.Count
int Count { get; }
property int Count {
    int get ();
}
function get Count () : int

Property Value

Type: System.Int32
The number of objects in the Commands collection.

Implements

Commands.Count

Examples

Sub CountExample(ByVal dte As DTE2)

    ' Display all add-ins.
    Dim i As Integer
    Dim addIn As AddIn
    Dim msg As String

    For i = 1 To dte.AddIns.Count
        addIn = dte.AddIns.Item(i)
        msg &= "    " & addIn.Name

        If addIn.Connected Then
            msg &= " (Loaded)" & vbCrLf
        Else
            msg &= " (Not Loaded)" & vbCrLf
        End If
    Next

    MsgBox("Available add-ins:" & vbCrLf & vbCrLf & msg)

End Sub
public void CountExample(DTE2 dte)
{
    // Display all add-ins.
    AddIn addIn;
    string msg = "";

    for (int i = 1; i <= dte.AddIns.Count; ++i)
    {
        addIn = dte.AddIns.Item(i);
        msg += "    " + addIn.Name;

        if (addIn.Connected)
            msg += " (Loaded)\n";
        else
            msg += " (Not Loaded)\n";
    }

    MessageBox.Show("Available add-ins:\n\n" + msg);
}

.NET Framework Security

See Also

Reference

Commands2 Interface

Commands2 Members

Count Overload

EnvDTE80 Namespace

Other Resources

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