Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- List<Account> users = new List<Account>();
- string path = @"D:\C#\myAccounts.txt";
- string input1;
- string input2;
- using (StreamReader sr = new StreamReader(path))
- {
- string line = sr.ReadToEnd();
- Console.WriteLine(line);
- // List<string> ReadFile = File.ReadAllLines(@"C:\TEMP\FILE.TXT").ToList();
- }
- do
- {
- Console.WriteLine("Enter your username or type exit to quit");
- input1 = Console.ReadLine();
- if (input1 == "exit")
- break;
- Console.WriteLine("Ener your password:");
- input2 = Console.ReadLine();
- Account account = new Account(input1,input2);
- users.Add(account);
- } while (true);
- foreach (Account account in users)
- {
- Console.WriteLine(" Username: " + account.userName + " Password: " + account.passWord);
- File.AppendAllText(path," Username: " + account.userName.ToString() + "\r\n" + " Password: " + account.passWord.ToString() + "\r\n");
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement