There is a student class in which the name and password are checked (which are stored in a file). Adding students to the file goes through the Director class
class Student : User { public Student () { } public Student(string _name, string _surname, string _password) : base(_name, _surname, _password) { } public bool CheckPassword(string n, string s, string p) { name = n; surname = s; password = p; // TextReader tr = new StreamReader("D:\\Students\\Students.txt"); // String str = ""; // str = tr.ReadLine(); // foreach() } } Director class
class Director : User { public Director(string _name, string _surname, string _password) : base(_name, _surname, _password) { } public void AddStudent() { Console.WriteLine("Имя:"); name = Console.ReadLine(); Console.WriteLine("Фамилия:"); surname = Console.ReadLine(); Console.WriteLine("Пароль:"); password = Console.ReadLine(); new Student(name, surname, password); using (var writer = new StreamWriter("D:\\Students\\Students.txt", true)) { //Добавляем к старому содержимому файла writer.WriteLine("Name: {0}\n Surname: {1}\n Password: {2}", name, surname, password); } } } How to check the information entered from the console with the file?