Add properties to class dynamically C#
<p>I want to add properties to a class dynamically and set values to them. Could someone point me in the right direction to some tutorials or articles or even better provide an example.</p>

<p>I have a base class which is called in a foreach loop. Inside this class I need to add up to 30 properties and set values to them.</p>

<p>This is the method that calls the class.</p>

<pre><code>foreach (Class name in this.list)
{
    ClassBeingCalled class = new ClassBeingCalled (name);
    class.Populate();
    this.newlist.Add(class);
}
</code></pre>

<p>Now inside the class being called, I need to create the 30 or so properties on the fly, which will be set in the "Populate" method of that class.</p>

<p>Like so...</p>

<pre><code> foreach (PropertyToAssign count2 in listofproperties)
 {
     string name = "_nameofproperty" + count2.name
     base.GetType().GetField(name, BindingFlags.NonPublic |
                          BindingFlags.Instance).SetValue(this, count2);
 }
</code></pre>
