麻烦大家告诉一下我怎么去获取list<>的长度
List<string> a = new List<string>();
int i = 0;
while (true)
{
a.Add(Console.ReadLine());
string c = a[i];
if (c == "")
break;
i++;
}
想问一下,怎么去表示a的长度,我用a.length貌似不能获取
[解决办法]
try this:
List<string> a = new List<string>();
int i = 0;
while (i<10)
{
a.Add(i.ToString());
i++;
}
Console.ReadLine(a.Length);