C#高手请进,静态二维数组赋值问题,在线等
在QuestionHelper.cs类文件中有这样的定义:publicstaticbool[][]correctMultipleAnswers=newBoolean[20...
在QuestionHelper.cs类文件中有这样的定义:
public static bool[][] correctMultipleAnswers= new Boolean[20][]; // 标准答案数组
在另一文件内:
经测试运行过程中multipleSdr有数据,为什么程序运行到红色方框标记的地方就报“未将对象引用设置到对象的实例”的错误?高手,请帮忙解答一下,谢谢! 展开
public static bool[][] correctMultipleAnswers= new Boolean[20][]; // 标准答案数组
在另一文件内:
经测试运行过程中multipleSdr有数据,为什么程序运行到红色方框标记的地方就报“未将对象引用设置到对象的实例”的错误?高手,请帮忙解答一下,谢谢! 展开
展开全部
看看什么情况。楼上的正解。
public static bool[,] correctMultipleAnswers= new Boolean[20,5];
调用时:
QuestionHelper.correctMultipleAnswers[j,0] = Convert.ToBoolean(multipleSdr["AnswerA"]);
QuestionHelper.correctMultipleAnswers[j,1] = Convert.ToBoolean(multipleSdr["AnswerB"]);
QuestionHelper.correctMultipleAnswers[j,2] = Convert.ToBoolean(multipleSdr["AnswerC"]);
QuestionHelper.correctMultipleAnswers[j,3] = Convert.ToBoolean(multipleSdr["AnswerD"]);
QuestionHelper.correctMultipleAnswers[j,4] = Convert.ToBoolean(multipleSdr["AnswerE"]);
public static bool[,] correctMultipleAnswers= new Boolean[20,5];
调用时:
QuestionHelper.correctMultipleAnswers[j,0] = Convert.ToBoolean(multipleSdr["AnswerA"]);
QuestionHelper.correctMultipleAnswers[j,1] = Convert.ToBoolean(multipleSdr["AnswerB"]);
QuestionHelper.correctMultipleAnswers[j,2] = Convert.ToBoolean(multipleSdr["AnswerC"]);
QuestionHelper.correctMultipleAnswers[j,3] = Convert.ToBoolean(multipleSdr["AnswerD"]);
QuestionHelper.correctMultipleAnswers[j,4] = Convert.ToBoolean(multipleSdr["AnswerE"]);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询