共用方式為


Commands2.Count 屬性

取得值,指出 Commands 集合中物件的數目。

命名空間:  EnvDTE80
組件:  EnvDTE80 (在 EnvDTE80.dll 中)

語法

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

屬性值

類型:Int32
Commands 集合中的物件數目。

範例

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 安全性

請參閱

參考

Commands2 介面

EnvDTE80 命名空間

其他資源

如何:編譯和執行 Automation 物件模型程式碼範例