Commands.Count 属性

获取一个值,该值指示 Commands 集合中对象的数目。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

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

属性值

类型:System.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 安全性

请参见

参考

Commands 接口

EnvDTE 命名空间

其他资源

如何:编译和运行自动化对象模型代码示例