System.Collections doesn't show up in "Directives usings and references"

If I try to use a data type from System.Collections, I get a syntax error.

var data = new ArrayList();

=>

The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)

Yet when I go to “Usings and References” it doesn’t show up there for me to choose. I see System, System.Configuration, System.Core, System.Data… but no Collections. But if I specify the whole path, e.g.

var data = new System.Collections.ArrayList();

Then the syntax error goes away. But I would like to not have to be so verbose.

  1. System.Collections namespace has been obsoleted umm… 14 years ago with the release of .NET 2.0. It still is supported because of backward compatibility only. So it is much better to use types from System.Collections.Generic namespace.
  2. If you really need to use types like ArrayList, then you can add related using statement via Directive using and references dialog.

2 Likes

Thanks, I can take that approach, and I actually wound up going with a System.Collections.Generic data type instead. But the strange thing is, I don’t see anything with System.Collections at all, including System.Collections.Generic, so I suppose I’ll have to add a using for it as well.