CommandLineIterator.cs 709 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace TodoList
  5. {
  6. public struct CommandLineIterator
  7. {
  8. public readonly String[] Arguments;
  9. public readonly int Place;
  10. public String Peek()
  11. {
  12. return Arguments[Place].ToLower();
  13. }
  14. public CommandLineIterator(String[] Arguments, int Place)
  15. {
  16. this.Arguments = Arguments;
  17. this.Place = Place;
  18. }
  19. public CommandLineIterator Advance()
  20. {
  21. return new CommandLineIterator(Arguments, Place + 1);
  22. }
  23. public bool AtEnd()
  24. {
  25. return Place >= Arguments.Length;
  26. }
  27. }
  28. }