title: Can't set TimeSpan property from JSON source C#
body: <p>I have been trying to read a JSON file and deserialize it to a class object. The problem is that I am storing a <code>TimeSpan?</code> property of the class as <code>string</code> in the JSON file which doesn't get deserialized and remains null. Please find the code for reference below:</p>
  <p>Interface:</p>
  <pre><code>public interface IAirport
  {
    .
    .
    .
    TimeSpan? TimeOffset { get; set; }
    .
    .
    .
  }
  </code></pre>
  <p>Class :</p>
  <pre><code>public class Airport:IAirport{
    .
    .
    .
    private TimeSpan? _offsetTime;
    public TimeSpan? OffssetTime
    {
      get{return _offsetTime;}
      set{SetProperty&lt;TimeSpan&gt;(ref _offsetTime, value);}
    }
    .
    .
    .
  }
  </code></pre>
  <p>This is the way I deserialize :</p>
  <pre><code>private static T ConvertJsonStreamToObject&lt;T&gt;(StreamReader fileStream)
          {
              JsonSerializer serializer = new JsonSerializer();
              return (T)serializer.Deserialize(fileStream, typeof(T));
          }
  </code></pre>
  <p>and lastly the JSON :</p>
  <pre><code>{
      &quot;AirportDesignation&quot;: &quot;ZZU&quot;,
      &quot;EffectiveDate&quot;: &quot;1901-01-01 00:00:00.0000000&quot;,
      &quot;Description&quot;: &quot;Mzuzu&quot;,
      &quot;DescriptionShort&quot;: &quot;Mzuzu&quot;,
      &quot;EffectiveStatus&quot;: &quot;A&quot;,
      &quot;Country&quot;: &quot;MWI&quot;,
      &quot;State&quot;: &quot; &quot;,
      &quot;LatitudeDegrees&quot;: 11,
      &quot;LatitudeMinutes&quot;: 27,
      &quot;LatitudeSeconds&quot;: 0,
      &quot;LatitudeCoordinates&quot;: &quot;S&quot;,
      &quot;LongitudeDegrees&quot;: 34,
      &quot;LongitudeMinutes&quot;: 1,
      &quot;LongitudeSeconds&quot;: 0,
      &quot;LongitudeCoordinates&quot;: &quot;E&quot;,
      &quot;AirportType&quot;: &quot;A&quot;,
      &quot;TimeOffset&quot;: &quot;00:00:00&quot;,
      &quot;IsTimeOffsetPositive&quot;: true
    }
  </code></pre>
  <p>I tried the following way to set the property and use <code>TimeSpan.Parse()</code> to parse the <code>string</code> to <code>TimeSpan</code> but none of them worked :</p>
  <pre><code>private string _timeOffset;            
  public TimeSpan? TimeOffset
  {
    get { return TimeSpan.Parse(_timeOffset); }
    set { _timeOffset = value.ToString(); }
  }
  </code></pre>
  <p>I am out of ideas to try, any help would be appreciated.</p>
  <p>UPDATE:
  I tried @Caius Jard suggestion, getting the <code>System.ArgumentNullException</code></p>
  <p>Updated the property as below:</p>
  <pre><code>private string _timeOffset;
          [Required]
          public TimeSpan? TimeOffset
          {
              get { return TimeSpan.Parse(_timeOffset); }
              set { SetProperty&lt;string&gt;(ref _timeOffset, value.Value.ToString()); }
          }
  </code></pre>