Ejemplo n.º 1
0
        /// <summary>
        /// Read names from text file
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        private List <Name> ParseAndReadInput(string filename)
        {
            var names = new List <Name>();

            // Read file using StreamReader.Reads file line by line
            using (StreamReader file = new StreamReader(filename))
            {
                string fullName;

                while ((fullName = file.ReadLine()) != null)
                {
                    names.Add(new Name
                    {
                        FullName     = fullName,
                        SearchString = _sortStrategy.GetSearchStringFromName(fullName)
                    });
                }
                file.Close();
            }
            return(names);
        }