Dynamically create objects based on a runtime count value - C#
<p>Simple example of scenario I am trying to implement</p>

<pre><code>class ATest
{
    int a;
    int b;
    BTest[];
}

class BTest
{
    int X;
    int Y;
}
</code></pre>

<ul>
<li>I need to create <code>ATest</code> and <code>BTest</code> dynamically based on a value.</li>
<li>I tried it as <code>Atest[] aobj = new Atest[count];</code> (This count value will be set programmatically)</li>
<li>Now I need to create Array of Objects of <code>B</code> dynamically and assign it to <code>A</code></li>
<li><p>Currently I assume static value for count and assigned it </p>

<pre><code>Atest[] aobj = new Atest[20];   
BTest[] bobj = new BTest[1];
bobj[0] = new Btest();
aobj[0] = new ATest();
aobj[0].BTest = bobj;
BTest[] bobj1 = new BTest[1];
bobj1[0] = new Btest();
aobj1[0].BTest = bobj1;
</code></pre></li>
</ul>

<p>This may not be the best way to code. </p>

<p>Please suggest on dynamically implementing it
- Dynamically create number of <code>BTest</code> object arrays and assign it for <code>ATest</code> instances</p>
