使用通用型“System.Collections.Generic.List< T>”要求1类型参数 [英] Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments

查看:2097
本文介绍了使用通用型“System.Collections.Generic.List< T>”要求1类型参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是什么意思?我用列表中的ASP.NET MVC的名单,并送他们到的ViewData ActionResuls 的检索它的观点。

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.

然而,当我将其更改为清单列表,它给了我 HttpWebException 的错误。当我检查立即窗口中,它告诉我的错误是:

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:

使用泛型类型System.Collections.Generic.List< T>'需要1类型参数

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?

推荐答案

名单,其中,T&GT; 类是一个泛型类型

为了使用它,你需要提供一个类型参数。

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

例如,如果你想有一个整数列表,你需要声明为名单,其中,INT&GT; ,不是列表

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

这篇关于使用通用型“System.Collections.Generic.List&LT; T&GT;”要求1类型参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆