title: c# Array generics with each array item of different type
body: <p>I have a struct defining some pair type wich uses generics:</p>
  
  <pre><code>struct SomeNameValuePair&lt;T&gt;
  {
      string TypeName;
      T Value;
  }
  </code></pre>
  
  <p>and a need to declare an array of SomeNameValuePair:</p>
  
  <pre><code>SomeNameValuePair&lt;T&gt;[] someNameValuePair=new SomeNameValuePair&lt;T&gt;[3];
  </code></pre>
  
  <p>The problem is that I need different types for Value property for different array Items.
  In code it is much easier to understand:</p>
  
  <pre><code>SomeNameValuePair&lt;int&gt; tempSomeNameValuePair0;
  
  tempSomeNameValuePair0.TypeName="int";
  tempSomeNameValuePair0.Value=10;
  
  
  SomeNameValuePair&lt;double&gt; tempSomeNameValuePair1;
  
  tempSomeNameValuePair1.TypeName="double";
  tempSomeNameValuePair1.Value=10.5;
  
  tempSomeNameValuePair2.TypeName="string";
  tempSomeNameValuePair2.Value="Random String";
  
  someNameValuePair[0]=tempSomeNameValuePair0
  someNameValuePair[1]=tempSomeNameValuePair1
  someNameValuePair[2]=tempSomeNameValuePair2
  </code></pre>
  
  <p>Obviusly my code does not work as when instantiating array <code>someNameValuePair=new SomeNameValuePair&lt;T&gt;[3];</code>, I am committing the array property Value of its items to be of type T.</p>
  
  <p>Is there any way to achieve my goal in C#?</p>