TimeSpans cann't be serialized. The best workaround I've found is to serialize the TimeSpan Ticks property instead. This can be done as follows:
private TimeSpan _sampleRate = new TimeSpan(0, 0, 0, 1, 0);
[XmlIgnore]
public TimeSpan SampleRate
{
get { return _sampleRate; }
set { _sampleRate = value; }
}
[XmlElement("SampleRate"), Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public long SampleRateTicks
{
get { return SampleRate.Ticks; }
set { SampleRate = new TimeSpan(value); }
}
As always, feel free to comment, or ask.