I have a collection class which contains 1 property – an array of a sub class.
For the sake of the question. I have a basket class, then fruits[] as the one property of basket. The fruit class contains 3 properties for example. Name, Color and Size.
How can I make the basket class behave so that I can use foreach loops on it?
In this simple case, you can delegate the enumeration to the array, like this: