Your company uses Visual Studio .NET as its application development platform. You have recently finished development of a class named ShopList using the .NET Framework. The class will include ShopItem objects that have the public properties exhibit below:
1. Name
2. ID
3. DiscountCode
You need to enable users of the class to iterate through the ShopList collection, and to list each product's name and ID using the foreach statement. Which of the following code segments will you use to accomplish this task?
Options
- public class ShopList : IEnumerator, IEnumerable { // Class implementation }
- public class ShopList : IBindingList { // Class implementation }
- public class ShopList : IDictionary { // Class implementation }
- public class ShopList : ICollection { // Class implementation }
CORRECT ANSWER : public class ShopList : IEnumerator, IEnumerable { // Class implementation }
Write your comments