Exemple #1
0
        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);
        }
Exemple #2
0
 public void Register <TType>(string key, IParseFactory <TType> factory)
 {
     GetTypeFactories(typeof(TType))[key] = factory;
 }