Question: Can someone please help for real!!! EX2: Implement the IEnumerable interface In this exercise, youll implement the IEnumerable interface in the list class of the
Can someone please help for real!!!
EX2: Implement the IEnumerable interface
In this exercise, youll implement the IEnumerable interface in the list class of the Inventory Maintenance application from extra exercise 15-1.
Open the InventoryMaintenance project in the Assignments\Chapter 15\InventoryMaint With IEnumerable directory.
Display the code for the InvItemList class, and modify its declaration to indicate that it implements the IEnumerable interface. Then, generate a code stub for the only member of this interface, the GetEnumerator method.
Replace the generated throw statement for the GetEnumerator method with a foreach statement that returns each item thats stored in the list for the class. Be sure to precede the return keyword with the yield keyword.
Display the code for the Inventory Maintenance form. Then, modify the code for the FillItemListBox so it uses a foreach statement instead of a for statement.
Test the application to be sure it still works.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
