public string this[Pupil pupil, Lesson lesson] { get { try { return(marks[Lessons.IndexOf(lesson), Pupils.IndexOf(pupil)]); } catch (Exception) { throw new IndexOutOfRangeException("pupil or lesson haven't found"); } } set { try { marks[Lessons.IndexOf(lesson), Pupils.IndexOf(pupil)] = value; } catch (Exception) { throw new IndexOutOfRangeException("pupil or lesson haven't found"); } } }