[RESOLVED] C# Casting Issues
Hey,
I have a few casting issues. I have an ArrayList called bonusBoxes that holds elements of the type BonusBoxes. Sooo...
bonusBoxes is an ArrayList filled with elements of type 'BonusBox'. The class BonusBox has a method in it called getPosY() which returns a double (I think). When I cast the array and then try and call the function using:
CSharp Code:
(BonusBox)(bonusBoxes[0]).getPosY()
I get an error that states that type 'object' dosn't have a method or extension named getPosY. I usually cast things in C++ using this code:
C++ Code:
static_cast<BonusBox^>(bonusBoxes[0])->getPosY()
And this works perfectly. Anyone know how I could do this in c# and I really don't want to create a new variable and then store the casted class in that as it gets way too messy! Thanks,
Josh