+ 1
How to put 2 poins in a 2d array in C#
I have class point with properties and I need to put an x and y point in 2d array and it s something like this: Point[,] p = new Point [100,2]; Main p[0,0].x = Convert.ToInt32(textbox1.text) // how would this inicialization be correct ???
3 Réponses
+ 2
Doesn't it work as:
Point[][] p = new Point(); ?
And changing values as:
p[x][y] = z;
+ 2
Its throws me exception null reference 'Object reference not set to an instance of an object,
+ 1
maybe you should add parentheses within the creation:
Point[,] p = new Point([100, 2])