共用方式為


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 物件,並顯示集合中視窗的數目。

如需如何像執行增益集一般,執行這個範例的詳細資訊,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例

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 命名空間

其他資源

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