Exemplo n.º 1
0
        public ICollection<PhoneBookItem> ReadPhoneBook(string filePath)
        {
            var phoneBookItems = new List<PhoneBookItem>();

            using (var file = new StreamReader(filePath))
            {
                string line;
                while ((line = file.ReadLine()) != null)
                {
                    var phoneBookItemsInfo = line.Split(this.phoneItemsSeparators, StringSplitOptions.RemoveEmptyEntries);
                    var phoneBookItem = new PhoneBookItem(phoneBookItemsInfo[0], phoneBookItemsInfo[1], phoneBookItemsInfo[2]);
                    phoneBookItems.Add(phoneBookItem);
                }
            }

            return phoneBookItems;
        }
Exemplo n.º 2
0
        public ICollection <PhoneBookItem> ReadPhoneBook(string filePath)
        {
            var phoneBookItems = new List <PhoneBookItem>();

            using (var file = new StreamReader(filePath))
            {
                string line;
                while ((line = file.ReadLine()) != null)
                {
                    var phoneBookItemsInfo = line.Split(this.phoneItemsSeparators, StringSplitOptions.RemoveEmptyEntries);
                    var phoneBookItem      = new PhoneBookItem(phoneBookItemsInfo[0], phoneBookItemsInfo[1], phoneBookItemsInfo[2]);
                    phoneBookItems.Add(phoneBookItem);
                }
            }

            return(phoneBookItems);
        }