public IEnumerable <BankAccount> ReadFromStorage() { List <BankAccount> bankAccountsList = new List <BankAccount>(); int id; string name; string surname; long sum; int bonus; string gradation = "Base"; using (BinaryReader reader = new BinaryReader(File.Open(FILENAME, FileMode.Open))) { while (reader.PeekChar() > -1) { id = reader.ReadInt32(); name = reader.ReadString(); surname = reader.ReadString(); sum = reader.ReadInt64(); bonus = reader.ReadInt32(); gradation = reader.ReadString(); AccountManager manager = new AccountManager(); bankAccountsList.Add(manager.CreateBankAccount(gradation)); BankAccount tempAccount = bankAccountsList.Last(); tempAccount.AddAccontInfo(id, name, surname, sum, bonus); } } return(bankAccountsList); }