1
我有把一本字典,具有Vector2数组作为它的值类型为字典,是一类属性的问题:添加字典
Dictionary<string, Dictionary<string, Vector2[]>> foo = new Dictionary<string, Dictionary<string, Vector2[]>>(); // OK
foo.Add("bar", new Dictionary<string, Vector2[]>()); // OK
fooAttribute.add("bar", new Dictionary<string, Vector2[]>()); // NOT OK
属性的宣言是:
protected Dictionary<string, Dictionary<string, Vector2[]>> fooAttribute;
它适用于局部变量,但它失败的属性,出现以下错误:
Error CS1061: Type
System.Collections.Generic.Dictionary<string,System.Collections.Generic.Dictionary<string,UnityEngine.Vector2[]>>' does not contain a definition for
add' and no extension methodadd' of type
System.Collections.Generic.Dictionary>' could be found (are you missing a using directive or an assembly reference?) (CS1061) (Assembly-CSharp)
啊愚蠢的错误,谢谢。我不习惯大写字母的方法名称:/ – whatever0010011 2013-03-25 11:16:44