[Mono-list] how to use System.Collections.Generic
Jonathan Pryor
jonpryor at vt.edu
Fri Mar 6 21:36:29 EST 2009
On Fri, 2009-03-06 at 19:22 -0700, Ryan Heaton wrote:
> Hi all. Sorry for the newbie question, but I can't seem to use the
> System.Collections.Generic.List class. What assembly reference do I
> need? I'm on Ubuntu Intrepid, using "gmcs". Here's my error:
>
> error CS0234: The type or namespace name `List' does not exist in the
> namespace `System.Collections.Generic'. Are you missing an assembly
> reference?
It would help if you provided some code, but I believe that you're
missing the type parameter, e.g. you're doing:
var list = new System.Collections.Generic.List ();
List<T> is a generic type; the generic parameter is required. (There
are no "raw types" like Java 5 has.) Thus, if this is the case, you
need to provide an actual parameter type, e.g.
var list = new System.Collections.Generic.List<int> ();
- Jon
More information about the Mono-list
mailing list