title: Using a variable as a dynamic property name
body: <p>I have this, which works fine:</p>
  
  <pre><code>private void BindFilter(DropDownList ddl, IEnumerable&lt;dynamic&gt; items)
  {
      ddl.Items.Clear();
      foreach (var item in items)
      {
          ddl.Items.Add(item.bodystyle.ToString());
      }
  }
  </code></pre>
  
  <p>I know bodystyle is a property on item.</p>
  
  <p>Is it possible though to do this by passing the string as a variable, like this:</p>
  
  <pre><code>private void BindFilter(DropDownList ddl, string field, IEnumerable&lt;dynamic&gt; items)
  {
      ddl.Items.Clear();
      foreach (var item in items)
      {
           ddl.Items.Add(item.{field}.ToString());
      }
  }
  </code></pre>