So let's say I have an array of instances of different objects. For a simplified example, say I have a class called apple() and one called orange(), and I have an array that stores many instances of both apples and oranges. There's no way to predict whether element N is an apple or an orange until it's looked at directly.
If I'm iterating through this array with a simple foreach loop, and I want to make a brand new instance of the same type as each element in the array, how would I do it? I know I can use typeof to get the object name as a string, but that doesn't help me instantiate a new instance of it.