引用命名空间:
using System.Collections;
不行哈,ArrayList是System.Collections下的一个类型,而不是System.Collections.Generic下的,如果你不引用可以直接这么写:
System.Collections.ArrayList = new System.Collections.ArrayList(arr);
上面得也是对的
用using System.Collections.Generic就没有把ArrayList这个类型引用进去,会报错