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

后端 未结 3 741
被撕碎了的回忆
被撕碎了的回忆 2020-12-07 03:22

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, wh

相关标签:
3条回答
  • 2020-12-07 03:24

    I guess you wrote something like List<List>> ...
    But there is no class named List.. - List has a generic type parameter.
    For example - list of lists of integers should be

    List<List<int>> listOfLists = .....
    

    For better understanding of C# generics take a look here.

    0 讨论(0)
  • 2020-12-07 03:36

    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.

    0 讨论(0)
  • 2020-12-07 03:45

    I was able to just use using System.Collections.Generic; to get access to lists.

    0 讨论(0)
提交回复
热议问题