public IEnumerable <T> Parse <T>(IParseFactory <T> factory) { var result = new List <T>(); var file = new StreamReader(this.path); string line; int lineNum = 0; while ((line = file.ReadLine()) != null) { result.Add(factory.Create(new Line(line, lineNum++, file.EndOfStream))); } file.Close(); return(result); }
public void Register <TType>(string key, IParseFactory <TType> factory) { GetTypeFactories(typeof(TType))[key] = factory; }