Managed Struct

I may have to post this elsewhere, but thought someone could help as it may not be a managed issue.
I want to create a struct with an int and an array of int code:
1
2
3
4
5
public value struct square
	{
		static Int32 val = 0;
		static array<Int32>^ validBits = gcnew array<Int32>(9);
	};


I want a two dimensional array of this struct code:
array<square^,2>^ squares = gcnew array<square^,2>(9,9);

when i try to populate the array of int within the strict code:
squares[i,b]->validBits = getNextNumber(i,b);
I get error "Object reference not set to an instance of an object."}
I am sure this is obvious, but cannot grasp it. thanks in advance.
I had to do
1
2
squares[i,b] = gcnew square;
squares[i,b]->validBits = getNextNumber(i,b);
Last edited on
Topic archived. No new replies allowed.