我在这条线上出现错误:public int[][] mySpiros;
错误是这样的:Field Spirograph.myList.mySpiros is never assigned to, and will always have its default value null
。
现在,此行是在类中编写的。我只想创建一个 double 数组,这样我就可以为用户生成的每个图形(描记器)存储我将来的参数。
编辑:好像实例化integers
的多个数组不是Microsoft最喜欢的操作:
最佳答案
您正在创建array of arrays,因此需要实例化数组,例如:
public int[][] mySpiros;
//create three reference variables to hold array references
mySpiros=new int[3][];
mySpiros[0]=new int[4];
mySpiros[1]=new int[] {11,22,33,44};
mySpiros[2]=new int[40];
关于c# - C#无法声明Int : Field is never assigned to, and will always have its default value null的公共(public) double 数组,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12452551/