一个函数的测试,请参阅下面的代码:关于产品NullExceptionError在C#
List<Square> tempArr = new List<Square>();
Coin tempCoin = new Coin(eCoinType.White);
Square tempMove = new Square(1, eColumn.A, tempCoin);
tempArr.Add(tempMove);
m_OtheloGame.isLegalMove(tempMove, ref tempArr);
与NullExceptionError最后一行画“tempArr”的编译器。
我不明白为什么,因为我已经在第一行中分配了tempArr,所以它不能为空。
你能解释一下你的意思是“编译器绘制tempArr”吗? – ChrisWue 2011-03-26 09:53:03
是的我的意思是它用红色加下划线 – Mulder 2011-03-26 09:56:32
当你试图编译它时,输出是什么? – ChrisWue 2011-03-26 09:58:14