April 2017
Intermediate to advanced
628 pages
13h 46m
English
In the code example, we set the student name and last name to specific values. This was just to illustrate the use of deconstruction. A more likely scenario would be to pass a student number to the Student class (in the constructor perhaps), as follows:
Student student = new Student(studentNumber);
The implementation within the Student class would then perform a database lookup using the student number passed through in the constructor. This will then return the student details. A more likely implementation of the Student class would probably look as follows:
public class Student{ public Student(string studentNumber) { (Name, LastName) = GetStudentDetails(studentNumber); } public string Name { get; private set; } public ...Read now
Unlock full access