How can I create a collection of references in C#
- by Jonathan Kaufman
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?