private void ReadCourseName(string _line, CourseSection _courseSection) { try { string[] nameSubstrings = _line.Split(new char[] { ' ' }, 3); string[] codeSubstrings = nameSubstrings[0].Split(new char[] { '*' }); _courseSection.SetName(codeSubstrings[0] + "*" + codeSubstrings[1]); _courseSection.SetSection(codeSubstrings[2]); _courseSection.SetName(nameSubstrings[2]); } catch (System.IndexOutOfRangeException e) { throw new InvalidCourseNameException("Course name is not in the expected format."); } }
private void ReadCourseName(string line, ref CourseSection course) { string[] nameSubstrings = line.Split(new char[] { ' ' }, 3); string[] codeSubstrings = nameSubstrings[0].Split(new char[] { '*' }); course.SetCode(codeSubstrings[0] + "*" + codeSubstrings[1]); course.SetSection(codeSubstrings[2]); course.SetName(nameSubstrings[2]); }