C#问题"'PlotObjects.Text'是'字段',但是像'类型'一样使用“ [英] C# Problem "'PlotObjects.Text' is a 'field' but is used like a 'type'"

查看:81
本文介绍了C#问题"'PlotObjects.Text'是'字段',但是像'类型'一样使用“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是C#的新手并在我的代码中遇到同样的问题:



Hi,
I am new in C# and get problem same below in my code:

private Dictionary<int, PlotObjects.Text> tsTextList;

private Dictionary<int, PlotObjects.Line> tsLineList;





编译时出现此错误:

''PlotObjects.Text''是''字段''但用作''类型''



热解决这个问题?

问候,



When compile get this error:
''PlotObjects.Text'' is a ''field'' but is used like a ''type''

Hot to solve this?
Regards,

推荐答案

PlotObjects.Text 是一个变量,并创建一个字典< TKey,TValue> ,您需要使用类型 TValue TKey 。例如:

PlotObjects.Text is a variable, and to create a Dictionary<TKey,TValue>, you need to use a type as TValue or TKey. For example:
private Dictionary<int, string> tsTextList;
 
private Dictionary<int, int> tsLineList;



PlotObjects.Text 不是类型,而是变量。


But PlotObjects.Text isn''t a type, but a variable.


这篇关于C#问题&quot;'PlotObjects.Text'是'字段',但是像'类型'一样使用“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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