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; }
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); }