title: Dynamically deserializing to a property in RestSharp
body: <p>I am playing with the Harvest API and I'm trying to automatically map the entities as easy as possible, unfortunately when I do a request like <code>GET /projects</code> it generates a result like so:</p>
  
  <pre><code>[{
      project: {
          name: "Test"
      }
  },
  {
      project: {
          name: "Test 2"
  }]
  </code></pre>
  
  <p>In RestSharp, I can't directly do this:</p>
  
  <pre><code>client.Execute&lt;List&lt;Project&gt;&gt;(request)
  </code></pre>
  
  <p>Because it is going to look for a property called <code>Project</code>. So I have to make another class that has that property, and call it like this:</p>
  
  <pre><code>client.Execute&lt;List&lt;ProjectContainer&gt;&gt;(request)
  </code></pre>
  
  <p>I don't want to make a 'container' class for every entity, so I thought I found a clever solution to make one class I can use on all:</p>
  
  <pre><code>public class ListContainer&lt;T&gt; where T : IHarvestEntity
  {
      public T Item { get; set; }
  }
  </code></pre>
  
  <p>But, of course, the deserializer has no idea it needs to map the entity name (or "Project") to the property <code>Item</code>. In the restsharp documentation I found that I could use <code>[DeserializeAs(Name = "CustomProperty")]</code> to tell the deserializer which field to map to this property. However, attributes do only allow constants, which means I can't do:</p>
  
  <pre><code>[DeserializeAs(Name = typeof(T).FullName)]
  public T Item { get; set; }
  </code></pre>
  
  <p>Does anyone know a clever solution to this? So i don't have to create 10 different container classes?</p>