Ok I am having a cross language hiccup. In C# with it's great collections like List and I have:
a Map class with properties of:
List
<byte[]>
Images;
List<Tile>
Tiles;
a Tile Class of:
byte[] ImageData;
int X;
int Y;
Now I want to add an image to the Map class and have the ImageData property of the Tile Classes to "reference" it. I have discovered I can't just assign it Images[0]. You can't have a reference to an object of a List.
My fix was to create a Dictionary. Is this the best way or can I somehow have a "pointer" to a collection of objects?
- in response to comments if i have a bunch of tiles which have imagedata pointing to the first byte array in the List and then i change that image in the list and grab the image in the Tiles and they are the previous image assignemnt. So assign tiles to have the first image in the list, then change that image, I now expect the tile sot reference the new image. They don't.
FINAL REVISION - Look at gladford3x's code (I haven't mastered formatting yet). last line in Main will be
myMap.Images[0] = image2;
well when you call the myMap.Tiles[0].ImageData it will have the data from the first byte array