Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments

DELETE me picture DELETE me · Jul 11, 2010 · Viewed 24.6k times · Source

What does it mean? I used a list of list in ASP.NET MVC and sent them through ViewData of ActionResuls to retrieve it in views.

However, when I change it to list of list, it gives me an error of HttpWebException. When I check it inside the immediate window, it tells me that the error is:

Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments

So, what does it mean and what did I do wrong using it?

Answer

SLaks picture SLaks · Jul 11, 2010

The List<T> class is a generic type.

In order to use it, you need to provide a type argument.

For example, if you want to have a list of integers, you need to declare it as List<int>, not List.