I've been trying to figure this out for a while and would hope someone can help me. There's no real way to ask, so I have to ask with an example. Let's say I want to make a control that acts kind of like the form designer. At run-time, you can drag, pre-coded objects onto the control. Let's say I've pre-coded a few controls (GraphicsLabel GraphicsShape, etc.), and they all inherit my basic GraphicsObject class. I would need to keep those objects in a list somewhere, so I make an arraylist that holds all the objects drawn. Now, I want to enumerate through that list, so I do this:
Which is a problem because I would need to interact with each object differently based on its type. So how would I tell if the current obj in the enumeration was a GraphicsLabel, or any other type of object that inherits GraphicsObject? This is kind of tough to explain and I hope it makes sense. Thanks in advance for your help.
VB.NET:
For each obj as GraphicsObject in objList
...
Next