ArrayList là ordered collection, index individually, alternative cho array.
Thuộc tính phổ biến:
| Sr.No | Thuộc tính & Mô tả |
|---|---|
| 1 | Capacity - Sức chứa. |
| 2 | Count - Số phần tử thực tế. |
| 3 | IsFixedSize - Có fixed size không. |
| 4 | IsReadOnly - Chỉ đọc không. |
| 5 | Item - Lấy/gán phần tử tại index. |
Ví dụ
using System;
using System.Collections;
namespace Demo {
class Program {
static void Main(string[] args) {
ArrayList x = new ArrayList();
x.Add(45); x.Add(53); x.Add(12); x.Add(88);
Console.WriteLine("Capacity: {0}", x.Capacity);
}
}
}
Default capacity = 4.