sharp-extensions/ArgumentReader.cs

38 lines
730 B
C#

using System;
namespace sharp.extensions
{
public class ArgumentReader
{
int current;
string[] arguments;
public ArgumentReader(String[] arguments)
{
this.arguments = arguments;
this.current = 0;
}
public String Current { get { return this.arguments[this.current]; } }
public String Next() { MoveNext(); return Current; }
public bool MoveNext(){
this.current++;
return this.current < this.arguments.Length;
}
public string[] NextFollowing(int n)
{
string[] result = this.arguments.Segment(this.current + 1, n);
this.current += result.Length;
return result;
return new string[0];
}
public string[] Reminder(){
return this.arguments.Segment(this.current+1);
}
}
}