Windows2.Count 属性

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

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

语法

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

属性值

类型:System.Int32
一个整数,包含 Windows2 集合中对象的数目。

实现

Windows.Count

示例

此示例创建一个 Windows2 对象并显示集合中窗口的数目。

有关如何作为外接程序运行此示例的更多信息,请参见 如何:编译和运行自动化对象模型代码示例

Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    CountWindowsExample(_applicationObject)
End Sub
Sub CountWindowsExample(ByVal dte As DTE2)
    Dim wins As Windows2
    wins = CType(_applicationObject.Windows, EnvDTE80.Windows2)
    MsgBox("The number of windows in the Windows2 collection is: " _
 & wins.Count)
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    CountWindowsExample(_applicationObject);
}
public void CountWindowsExample(DTE2 dte)
{
    Windows2 wins;
    wins = (EnvDTE80.Windows2)_applicationObject.Windows;
    MessageBox.Show("The number of windows in the Windows2
 collection is: " + wins.Count);
}

.NET Framework 安全性

请参见

参考

Windows2 接口

Count 重载

EnvDTE80 命名空间

其他资源

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