I'm new to C# and I'm writing a program where I have an ArrayList (unitArray) of Unit objects and am trying to call a non-static method on the object referenced in the ArrayList. I try to access the specific object and call it's method but it doesn't work. I'd be grateful for help resolving this issue.
Unit.unitArray[selectedUnit].DisplayUnitAttributes()
I get the following exception:
'object' does not contain a definition for 'DisplayUnitAttributes' and no extension method 'DisplayUnitAttributes' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
ArrayListare of one and the same type, as there is no sense in a more commonArrayListthen.