Hello, I have a question about set and get, I tried to search the forum for answers but i didnt find what i wanted. Sry if this question exists:$
1. How do i check that the StudentId to be at least 6 characters using the set?
Can i do it with set or I have to create a new method to store the studentId to the variable and check the length there?
2. As you can see for the array of courses I have created methods instead of using get and set. I couldn't figure out how to use get and set with arrays. Can you please tell me if this is possible and how I can do it?
Thanks in advance
public class StudentsInfo
{
public string studentId { get; set; }
public string name { get; set; }
public string surname { get; set; }
public string phone { get; set; }
private string[] courses = new string[4];
/*
* Add courses.
*
*/
public void addCourse(string[] tempCourse)
{
for (int i = 0; i <= 3; i++)
{
courses[i] = tempCourse[i];
}
}
public void getCourses(ref string[] tempCourses)
{
for (int i = 0; i <= 3; i++)
{
tempCourses[i] = courses[i];
}
}
};