字典带有值QUOT;变" [英] Dictionary With Value "Variable"

查看:77
本文介绍了字典带有值QUOT;变"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能创建这样一个字典:

I am hoping to create a dictionary like this:

Dictionary<string, Variable> dict = new Dictionary<string, Variable>

在此线程的如何命名动态地在C#中的变量的下面的代码示例是投票和接受为答案的问题:

In this thread How do I name variables dynamically in C#? the following code example was voted up and accepted as the answer to the question:

var vartable = new Dictionary<string, Variable>();
vartable[strLine] = new Variable(input);



然而,当我尝试做我得到这个错误信息同样的事情:

However, when I try to do the same thing I get this error Message:

The type or namespace name 'Variable' could not be found (are you missing a using directive or an assembly reference?)

我一直无法找到修复了这个命名空间。任何建议表示赞赏。

I have been unable to find a namespace that fixes this. Any advice is appreciated.

问候。

推荐答案

变量,就是要自己的类,所以你必须先定义它。

Variable is meant to be your own class, so you have to define it first.

这篇关于字典带有值QUOT;变&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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