0
我在Shapes[0].DamageofShape[0] = 7;
處收到空引用異常。我是否需要在某處進行另一次初始化?結構數組中的數組上的空引用異常
public struct TestArrayStruct
{
public int[] DamageofShape;
}
class Program
{
static void Main(string[] args)
{
TestArrayStruct[] Shapes = new TestArrayStruct[5];
Shapes[0].DamageofShape[0] = 7;
}
}
感謝。我還沒有寫出一年以上的結構,而且是基於視覺的,所以上下文略有不同。 – 2014-10-08 15:10:29