麻烦大家告诉一下我怎么去获取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貌似不能获取 --------------------编程问答-------------------- a.Count --------------------编程问答-------------------- try this:
List<string> a = new List<string>();--------------------编程问答-------------------- Count属性 --------------------编程问答-------------------- List<string> a = new List<string>();
int i = 0;
while (i<10)
{
a.Add(i.ToString());
i++;
}
Console.ReadLine(a.Length);
string s = "";
while (true)
{
s = Console.ReadLine();
if (s == "") break;
a.Add(s);
} --------------------编程问答-------------------- a.Count --------------------编程问答-------------------- a.Count()可以获取 这个是LINQ方式获取--这个是Linq
a.Length也可以获取 这个是集合的长度属性--这个是属性 --------------------编程问答-------------------- 楼上正解。。。 --------------------编程问答-------------------- a.Count()可以获取 这个是LINQ方式获取--这个是Linq
a.Count也可以获取 这个是集合的长度属性--这个是属性 --------------------编程问答-------------------- 啊。。。我写错了。。。。。
补充:.NET技术 , C#