试题详情

在C#中,观察下列代码,找出错误的行,并修改正确的选项是() ArrayList list = new ArrayList() { }; Customer teng = new Customer(" 马腾 ", 32, " 汕头市 "); Customer yun = new Customer(" 王云 ", 28, " 杭州市 "); Customer si= new Customer(" 李军 ", 25, " 仙桃市 "); list.Add(teng); list.Add(yun); list.Add(si); Console.WriteLine(" 排队等待的客户有:"); for (int i = 0; i < list.Length; i++)//(1) { Console.WriteLine("{0} 号:{1}", i+1, (list[i] as Customer).Name); }

A没有错

B注释(1)处的List.Length改成List.Count

C注释(1)处的List.Length改成List.Count()

D注释(1)处的List.Length改成List.Length()