次の方法で共有


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

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する