static void Main(string[] args) { Student studentOne = new Student(); studentOne.FirstName = "Ivan"; studentOne.MiddleName = "Petrov"; studentOne.LastName = "Ivanov"; studentOne.Address = "Dolno Uino"; studentOne.Course = "C# OOP"; }
public static void Main() { Student pesho = new Student( "Pesho", "Petrov", "Petrov", 1111, "Sofia", "0888 88 88 88", "*****@*****.**", "first", Specialty.SoftwareEngineering, University.Telerik, Faculty.FEA); Student gosho = new Student( "Pesho", "Petrov", "Petrov", 1111, "Sofia", "0888 88 88 88", "*****@*****.**", "first", Specialty.SoftwareEngineering, University.Telerik, Faculty.FEA); Student vanio = new Student( "Vesho", "Petrov", "Petrov", 11111, "Sofia", "0888 88 88 88", "*****@*****.**", "first", Specialty.SoftwareEngineering, University.Telerik, Faculty.FEA); // Test Equals() Console.WriteLine("pesho.Equals(gosho)"); Console.WriteLine(pesho.Equals(gosho)); Console.WriteLine("gosho.Equals(vanio)"); Console.WriteLine(gosho.Equals(vanio)); // Test opperators Console.WriteLine("pesho == gosho"); Console.WriteLine(pesho == gosho); Console.WriteLine("gosho != vanio"); Console.WriteLine(gosho != vanio); Console.WriteLine(); // Test ToString() Console.WriteLine(pesho); Console.WriteLine(); // Test Cloning Student ivan = (Student)vanio.Clone(); Console.WriteLine(vanio); Console.WriteLine(ivan); // Edit some data ivan.FirstName = "Ivan"; ivan.Address = "nov000"; ivan.Ssn = 123; ivan.Faculty = Faculty.FMU; vanio.Address = "4546"; vanio.Ssn = 345; vanio.University = University.TU; // Check Result Console.WriteLine(vanio); Console.WriteLine(ivan); // Test Compare To Console.WriteLine(vanio.CompareTo(gosho)); Console.WriteLine(pesho.CompareTo(gosho)); Console.WriteLine(gosho.CompareTo(vanio)); pesho.Ssn = 123; gosho.Ssn = 124; Console.WriteLine(pesho.CompareTo(gosho)); Console.WriteLine(gosho.CompareTo(pesho)); }
/// <summary> /// Adds element of type Student to the list. Required in order to befit from object initializers in the code. /// </summary> /// <param name="student">Single instance of Student type</param> public void Add(Student student) { this.AllStudents.Add(student); }
static public void AddStudentToDB(Student student) { string info = student.IdStudent.ToString() + '\t' + student.LastName + '\t' + student.FirstName + '\t' + student.SecondName + '\t' + student.Faculty + '\t' + student.Department + '\t' + student.GPA + '\t' + student.Privilege; File.AppendAllText(spath, info + "\r\n"); }