title: Cannot cast from source type to destination type
body: <p>I am new to C# so I was doing some tutorials.
  I get this error when I try to run a tutorial Android project from Xamarin Studio:</p>
  
  <blockquote>
    <p>A System.InvalidCastException was thrown. Cannot cast from source type to destination type.</p>
  </blockquote>
  
  <p>This is the code that gives the error:</p>
  
  <pre><code>public Java.Lang.Object [] GetSections ()
  { 
      var intPtr = JNIEnv.NewArray (sections.ToArray ());
      var array = new JavaArray&lt;Java.Lang.Object&gt; (intPtr, JniHandleOwnership.TransferLocalRef);
      return (Java.Lang.Object []) array;
  }
  </code></pre>
  
  <p>How can I fix this?</p>