@@ -17,34 +17,19 @@ namespace WebUntisAPI.Client.Models
1717 [ JsonConverter ( typeof ( TimegridJsonConverter ) ) ]
1818 public class Timegrid : IEnumerable < ( Day , SchoolHour [ ] ) >
1919 {
20- private readonly Dictionary < Day , SchoolHour [ ] > _schoolDays = new Dictionary < Day , SchoolHour [ ] > ( ) ;
21-
2220 /// <summary>
23- /// The count of school hours (mostly 5)
21+ /// All the school days with their school hours
2422 /// </summary>
25- public int SchoolDays => _schoolDays . Count ;
23+ public Dictionary < Day , SchoolHour [ ] > SchoolDays { get ; set ; } = new Dictionary < Day , SchoolHour [ ] > ( ) ;
2624
2725 /// <summary>
28- /// Get the school hours by the day
26+ /// The count of school days (mostly 5)
2927 /// </summary>
30- /// <param name="day">The day</param>
31- /// <returns>The school hours</returns>
32- /// <exception cref="KeyNotFoundException">Thrown when the given day not found (mostly <see cref="Day.Saturday"/> and <see cref="Day.Sunday"/>)</exception>
33- public SchoolHour [ ] this [ Day day ]
34- {
35- get => _schoolDays [ day ] ;
36- set
37- {
38- if ( _schoolDays . ContainsKey ( day ) )
39- _schoolDays [ day ] = value ;
40- else
41- _schoolDays . Add ( day , value ) ;
42- }
43- }
28+ public int SchoolDayCount => SchoolDays . Count ;
4429
4530 #region IEnumerable<SchoolHour[]>
4631 /// <inheritdoc/>
47- public IEnumerator < ( Day , SchoolHour [ ] ) > GetEnumerator ( ) => _schoolDays . Keys . Zip ( _schoolDays . Values , ( day , schoolHours ) => ( day , schoolHours ) ) . GetEnumerator ( ) ;
32+ public IEnumerator < ( Day , SchoolHour [ ] ) > GetEnumerator ( ) => SchoolDays . Keys . Zip ( SchoolDays . Values , ( day , schoolHours ) => ( day , schoolHours ) ) . GetEnumerator ( ) ;
4833
4934 IEnumerator IEnumerable . GetEnumerator ( ) => GetEnumerator ( ) ;
5035 #endregion
0 commit comments