I'm probably going about this in the wrong way, but I have a stack of Objects, and some of these can be ArrayLists. I want to be able to pop an object that is actually an ArrayList off the stack, unbox it, add something, and then pop it back on. For example:
Stack<Object> s = new Stack<Object>(); ArrayList l = new ArrayList(); Object x; s.Push(l); x = s.Pop(); x = (ArrayList)x; //This is the line I don't know how to do x.Add("Something"); s.push(x);
Does anyone have an idea of how to do what I'm trying to do?
Thanks in advance :)