Data Structures and Algorithms
with Object-Oriented Design Patterns in C# |
public interface Enumeration { bool hasMoreElements { get; } object nextElement(); }Given an enumeration e from some container c, the contents of c can be printed like this:
while (e.hasMoreElements) Console.WriteLine(e.nextElement());Devise a wrapper class to encapsulate a C# enumerator and provide the functionality of a Java enumeration.