选择"system.collection.Arraylist"是什么?

Gug*_*tro -6 c# arraylist

我正在研究ArrayList,以及我的指南,示例代码如下:

var sample= new ArrayList();
Run Code Online (Sandbox Code Playgroud)

我报告错误,然后单击右键,然后转到"解析"和"system.ArrayList Collection",问题正确地消失了.

我知道我必须这样做,因为我找到了一个指南,但我不明白原因.

究竟什么是"system.collection.arrayList",因为没有它,Visual Studio报告错误?

它是什么,它是什么意思?

谢谢

Sel*_*enç 5

这意味着ArrayList类是在System.Collections命名空间下定义的.您需要通过键入它的完全限定名称来使用它System.Collections.ArrayList,或者使用using指令(using System.Collections;)包含命名空间,并在没有命名空间的情况下使用它.

有关更多信息,请查看使用指令(C#参考)