title: NewtonSoft JsonConvert deserialize on dynamic object type
body: <p>I have an abstract object Item that has several children: RadioItem, CheckItem, etc.</p>
  
  <p>Each item stores its own properties in a serialized JSON string property.</p>
  
  <p>I'm trying to make a static class that can take in an Item, instantiate a new item from the JSON string and return that.</p>
  
  <p>Right now I have the code looking something like this:</p>
  
  <pre><code>public static Item GetFreshItem(Item dirtyItem)
  {
      string itemProperties = dirtyItem.InitialItemSettingsJSON;
  
      if (dirtyItem is RadioItem)
      {
          return JsonConvert.DeserializeObject&lt;RadioItem&gt;(itemProperties);
      }
  
      if (dirtyItem is CheckItem)
      {
          return JsonConvert.DeserializeObject&lt;CheckItem&gt;(itemProperties);
      }
      return null;
  }
  </code></pre>
  
  <p>Is there a way to not have a long list of If (x is Type) and use a more dynamic single return statement depending on the type that was passed in?</p>
  
  <p>I was thinking it'd be something like this (which doesn't work)</p>
  
  <pre><code>JsonConvert.DeserializeObject&lt;typeOf(dirtyItem)&gt;(itemProperties);
  </code></pre>