51
1
using System;
2
using System.Collections.Generic;
3
4
public class Program
5
{
6
public static void Main()
7
{
8
// initial array
9
var list = new List<string>();
10
Console.WriteLine("[0] Capacity: {0}", list.Capacity);
11
Console.WriteLine("[0] Count: {0}", list.Count);
12
// add 4 items...
13
for (int i = 0; i < 4; i++)
14
{
15
list.Add(i.ToString());
16
}
17
18
// check capacity & count
19
Console.WriteLine("[1] Capacity: {0}", list.Capacity);
20
Console.WriteLine("[1] Count: {0}", list.Count);
21
// add another 4 items...
22
for (int i = 0; i < 4; i++)
23
{
24
list.Add(i.ToString());
Cached Result