title: Invalid cast from 'System.DateTime' to 'System.DateTimeOffset'
body: <p>I have done a lot of searching but not come up with anything which can explain my problem, which I have no doubt is trivial.</p>
  
  <p>I've imported Json.NET 12.0.1 into my project from NuGet.</p>
  
  <p>In the code below, the line</p>
  
  <p><code>Console.WriteLine(json.Value&lt;DateTimeOffset&gt;("DateTime"));</code></p>
  
  <p>throws an </p>
  
  <blockquote>
    <p>Invalid cast from 'System.DateTime' to 'System.DateTimeOffset'</p>
  </blockquote>
  
  <p>exception, as commented.</p>
  
  <p>So, why can I explicitly cast </p>
  
  <p><code>json["DateTime"]</code> or <code>json.Value&lt;DateTime&gt;("DateTime")</code> to <code>DateTimeOffset</code> </p>
  
  <p>but not use <code>json.Value&lt;DateTimeOffset&gt;("DateTime")</code>?</p>
  
  <pre><code>using Newtonsoft.Json.Linq;
  using System;
  
  namespace JSONDates
  {
      class Program
      {
          static void Main(string[] args)
          {
              string dt = "2019-04-21T18:27:21.225+01:00";
              string jsonString = string.Format("{{\"DateTime\": \"{0}\"}}", dt);
              JObject json = JObject.Parse(jsonString);
  
              Console.WriteLine(json.Value&lt;DateTime&gt;("DateTime")); //OK
              Console.WriteLine((DateTimeOffset)json.Value&lt;DateTime&gt;("DateTime")); //OK
              Console.WriteLine(((DateTimeOffset)json["DateTime"])); //OK
              Console.WriteLine(json.Value&lt;DateTimeOffset&gt;("DateTime")); //{"Invalid cast from 'System.DateTime' to 'System.DateTimeOffset'."}
              Console.ReadLine();
  
          }
      }
  }
  </code></pre>