title: C# array of different objects
body: <p>I have 2 classes B and D. I have to create an array with 4 elements 2 of type B and 2 of type D. How do I do it?</p>
  
  <pre><code>B o1 = new B();
  D o2 = new D();
  B o3 = new B();
  D o4 = new D();
  </code></pre>
  
  <p>The array should be something like this:</p>
  
  <pre><code>array[0] = o1; array[1] = o2; array[2] = o3; array[3] = o4;
  </code></pre>