Countメソッド

ArrayListオブジェクトに実際に含まれている要素の数を取得します。

構文

Object.Count()

引数 - Object: 必須。常にArrayListオブジェクトの名前。

戻り値

ArrayListオブジェクトに実際に含まれている要素の数

備考

次の例では、Countメソッドの使用方法を示します。

例1:

'Create ArrayList Object
Dim Obj
Dim Cnt
Set Obj = CreateObject("System.Collections.ArrayList")

'Add Elements to the end of the ArrayList Object
Dim Index
Index = Obj.Add(10)
Index = Obj.Add(40)
Index = Obj.Add(20)
'Gets the number of elements actually contained in the ArrayList object.
Cnt = Obj.Count()  
'Output: 3