title: Setting value in an array via reflection
body: <p>Is there a way to set a single value in an array property via reflection in c#?</p>
  
  <p>My property is defined like this:</p>
  
  <pre><code>double[]    Thresholds      { get; set; }
  </code></pre>
  
  <p>For "normal" properties I use this code to set it via reflection:</p>
  
  <pre><code>PropertyInfo pi = myObject.GetType().GetProperty(nameOfPropertyToSet);
  pi.SetValue(myObject, Convert.ChangeType(valueToSet, pi.PropertyType), null);
  </code></pre>
  
  <p>How would I have to change this code to set the value in an array property at an arbitrary position?
  Thanks!</p>
  
  <p>BTW: I tried to use the index parameter, but that seems only to work for indexed properties, not properties that are arrays...</p>