Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C#

คุณสมบัติ Count ของคลาส ArrayList ใน C#

คุณสมบัติ Count ในคลาส ArrayList ใช้นับจำนวนสมาชิกใน ArrayList

ตัวอย่าง

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