I learned a new lesson today: Always post your code on Stack Overflow exactly as it appears in your problem. In an attempt to simplify the problem that I was having, I left out one very glaring issue with serializing/deserializing objects: I did not have a public parameterless constructor on my TimeBlock class.
For clarity, this was my actual TimeBlock class:
public class TimeBlock
{
public DayOfWeek Day { get; set; }
public LocalTime StartTime { get; set; }
public LocalTime EndTime { get; set; }
public TimeBlock(int day, int startTime, int endTime)
{
Day = (DayOfWeek)day;
StartTime = new LocalTime(startTime / 100, startTime % 100);
EndTime = new LocalTime(endTime / 100, endTime % 100);
}
public string GetDayOfWeekString()
{
return CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(Day);
}
}
Adding in the local constructor makes everything peachy.
public TimeBlock() {}