views:

60

answers:

2

Ok this is hard to explain, but here goes. I have a 3D list of objects. The objects type are called CObject, another class CTile inherts CObject.

       static public List<List <List <CObject>>> CObjList 
                  = new List<List<List<CObject>>>();

Ok now lets say that the list is full of information in the correct way. (Can be see via breakpionts in the code); So I go to access an item in list like below

CObjList.[0][0][0].titleImageId

Ok titleImageId is a member of CTile, but I cant access it by using this syntax. Its public and everything. All that I can access are the members of CObject class.

I hope I have explained myself as best I can there. Thanks

+1  A: 

Use:

CList l = CObjList[0][0][0] as CList;
if(l != null)
    id = l.titleImageId

You should index the CObjList directly, not using a dot operator

Sander Rijken
+2  A: 
((CTile)CObjList[0][0][0]).titleImageId

or

(CObjList[0][0][0] as CTile).titleImageId
Yuriy Faktorovich
That work!Thanks very much.
Ciarán