title: System.InvalidCastException: 'Unable to cast object of type 'System.String' to type 'Newtonsoft.Json.Linq.JToken'.'
body: <p>If I run the code:</p>
  
  <pre><code>    object myObject = "abc";
      JToken jToken = (JToken)myObject;
  </code></pre>
  
  <p>it compiles fine, but it throws the cryptic exception the title. It is cryptic since it is possible to cast form String to JToken as withnessed by the following compiling and running correctly:</p>
  
  <pre><code>    String mystring = "abc";
      JToken jToken2 = (JToken)mystring;
  </code></pre>
  
  <p>So I am very curious why this is happening?</p>
  
  <p>Of course the above example is a bit silly, but maybe to get a sense of why I am asking this is because the same error is also generated in the following situation.</p>
  
  <pre><code>class Program
      public static JToken apply_function(Delegate function, object[] arglist)
      {
          return (JToken)function.DynamicInvoke(arglist);
      }
  
      static void Main(string[] args)
      {
          Func&lt;string&gt; hello = () =&gt; { return "hello world!"; };
          Console.WriteLine(apply_function(hello, new object[0]));
      }
  }
  
  </code></pre>
  
  <p>Where in the actual situation where in want to use <code>apply_function</code>, is a situation where I do not have control over the return type, or the argument types of the Delegate supplied to <code>apply_function</code>. The only guarantee I have is that the Delegate will be a function that returns something that is castable to JToken.</p>