找不到通用类型“列表"的名称空间. [英] Cannot find the namespace for generic type "List"

查看:50
本文介绍了找不到通用类型“列表"的名称空间.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的错误,不知道如何解决.我有一个被另一个(主)表单打开的表单.当我写

I have a strange error and don't know how to solve that. I have a Form which gets opened by another (Main)Form. When I write

 List<String> valStoreAsString = new List<String>();

我得到找不到值或名称空间列表".我的using指令如下:

I get "The value or namespace List could not get found". My using directives are the following:

 using System;
 using System.ComponentModel;
 using System.Data;
 using System.Drawing;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using System.Data.SqlClient;
 using System.Collections;
 using System.Runtime.InteropServices;

在其他表单中,它可以正常工作.这里发生了什么事?

In the other Forms it works fine. What happened here?

推荐答案

在用户列表中添加以下using指令.

Add following using directive to the list of usings.

using System.Collections.Generic;

提示

如果您使用的是Visual Studio,并且您不知道名称空间,请在编辑器中键入类型名称(区分大小写),然后按ctrl + .并选择添加使用"选项,VS将使用为你.

If you are using Visual Studio and if you don't know the namespace then type name of type (Case sensetive) in editor and then press ctrl+ . and select add using option and VS will add related using for you.

,或者您可以右键单击类型"的名称,然后选择"Resolve"选项,然后选择"using ...."子选项.

or you can right click on name of Type and select Resolve option and select using .... sub option.

这篇关于找不到通用类型“列表"的名称空间.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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