C#中ArrayList类的Count属性是什么?
ArrayList类中的Count属性对ArrayList中的元素数进行计数。
首先,将元素添加到ArrayList-
ArrayList arrList = new ArrayList(); arrList.Add(98); arrList.Add(55); arrList.Add(65); arrList.Add(34);
然后获取数组列表的数量-
arrList.Count
以下是在C#中实现Count属性的代码-
示例
using System;
using System.Collections;
class Demo {
public static void Main() {
ArrayList arrList = new ArrayList();
arrList.Add(98);
arrList.Add(55);
arrList.Add(65);
arrList.Add(34);
Console.WriteLine("Count = " + arrList.Count);
}
}输出结果
Count = 4
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短