Gentlefolk,
Using C# in VS 2005.
I have a struct (some components deleted for simplicity) :
public struct CoOrdData
{
public int[] coOrdMaxArray; // = new int[3]; // XYZ co-ord maximum
..
..
}
This is used in the following objects:
public CoOrdData GraphData = new CoOrdData();
public CoOrdData trackGraph = new CoOrdData();
In the constructor for the surrounding class I have:
// Graph parameters,set the size (3) of the array
GraphData.coOrdMaxArray = new int[3];
trackGraph.coOrdMaxArray = new int[3];
This is done to establish the size of the array as you cant set the size in the struct.
All compiles clean, however during execution of an event on the surrounding class the following code corrupts things,
trackGraph.coOrdMaxArray[0] = GraphData.coOrdMaxArray[0] + (midX - adjX);
trackGraph.coOrdMaxArray[0] AND GraphData.coOrdMaxArray[0] are both set to (midX - adjX)!!!!!!
Extensive reading about value/reference and any example/tutorials on arrays and structures has not helped.
Any soultions/ideas/comments appreciated, Ian