title: Converting JObject to a dynamic object
body: <p>I am calling a REST endpoint from C# and I am receiving json which gets serialized into an object. One of the properties on this object is a dynamic property. The value of the dynamic property is set as a anonymous object on the server site like this:</p>
  
  <pre><code>myObject.MyDynamicProp = new { Id = "MyId2134", Name = "MyName" };
  </code></pre>
  
  <p>On the client site the value of the dynamic property from the json serialization is a JObject containing the following value:</p>
  
  <pre><code>{{
    "id": "MyId2134",
    "Name": "MyName"
  }}
  </code></pre>
  
  <p>I would have expected to be able to access the properties like this:</p>
  
  <pre><code>var s = myObject.MyDynamicProp.Name;
  </code></pre>
  
  <p>but it does not find the Name property instead I have to get the value like this:</p>
  
  <pre><code>var s = myObject.MyDynamicProp["Name"].Value;
  </code></pre>
  
  <p>I tried converting the JObject into a dynamic object like this but it returns JObject:</p>
  
  <pre><code>var dyn = myObject.MyDynamicProp.ToObject&lt;dynamic&gt;();
  </code></pre>
  
  <p>How can I convert the dynamic property value such that I can call its properties directly?</p>
  
  <pre><code>var s = myObject.MyDynamicProp.Name;
  </code></pre>
  
  <p>UPDATE ...</p>
  
  <p>I ran the following </p>
  
  <pre><code> dynamic d = JsonConvert.DeserializeObject("{\"MyDynamicProp\": {\"id\": \"MyId2134\", \"Name\": \"MyName\"}}");
   string name = d.MyDynamicProp.Name;
  </code></pre>
  
  <p>Which gives me the following the error:</p>
  
  <pre><code> {Microsoft.CSharp.RuntimeBinder.RuntimeBinderException:    `Newtonsoft.Json.Linq.JObject' does not contain a definition for `MyDynamicProp'
    at Microsoft.Scripting.Interpreter.ThrowInstruction.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00027]
  </code></pre>
  
  <p>I would like to add that this is an Xamarin iOS project and the code is located in a PCL library. </p>
  
  <hr>
  
  <p>I assumed there was a problem with my code but it looks like it is not possible to use dynamic types within a Xamarin iOS project.
  <a href="https://developer.xamarin.com/guides/ios/advanced_topics/limitations/" rel="noreferrer">https://developer.xamarin.com/guides/ios/advanced_topics/limitations/</a></p>