Search code examples
c#visual-c#-express-2010generic-collections

Incomplete System.Collections.Generic in Visual C# 2010 Express


I'm trying to access System.Collections.Generic.Stack<> in Visual C# 2010 Express, but the IDE (and compiler) claim that it's not present. Several other classes are also missing, including LinkedList<>, SortedList<> and Queue<>. I've checked the documentation for both the System.Collections.Generic namespace and C# Express, and can find no reference to any deliberate limitations.

Oddly enough, if I sort the documented contents of the System.Collections.Generic namespace alphabetically, everything after List<> is missing, but that may just be a very weird coincidence.

Edit: I tried a commandline build using MSBuild, which also complained with error CS0246. However, using csc worked.

Followup: I tried removing all resources from my project and adding a stub class which just created an instance of Stack<>. Not only did that work, everything still worked after adding the old class back in and removing the stub. I can only assume there was some kind of caching silliness going on. Very annoying. I'll re-open if this issue reappears.


Solution

  • I expect that your project is missing a reference to System.dll.

    Check whether "System" is listed under "References" in the solution explorer. If not, right-click References, choose "Add Reference...", and add a reference to "System".

    Note: List<T> is in mscorlib.dll, and all collections that are alphabetically after List<T> are in System.dll, which is why I think this is what's happening.