title: Using key-value pairs as parameters
body: <p>Simple. If I use:</p>
  
  <pre><code>public void Add(params int[] values)
  </code></pre>
  
  <p>Then I can use this as:</p>
  
  <pre><code>Add(1, 2, 3, 4);
  </code></pre>
  
  <p>But now I'm dealing with key-value pairs! I have a KeyValue class to link an integer to a string value. So I start with:</p>
  
  <pre><code>public void Add(params KeyValue[] values)
  </code></pre>
  
  <p>But I can't use this:</p>
  
  <pre><code>Add(1, "A", 2, "B", 3, "C", 4, "D");
  </code></pre>
  
  <p>Instead, I'm forced to use:</p>
  
  <pre><code>Add(new KeyValue(1, "A"), new KeyValue(2, "B"), new KeyValue(3, "C"), new KeyValue(4, "D"));
  </code></pre>
  
  <p>Ewww... Already I dislike this...</p>
  
  <p>So, right now I use the Add function without the params modifier and just pass a pre-defined array to this function. Since it's just used for a quick initialization for a test, I'm not too much troubled about needing this additional code, although I want to keep the code simple to read. I would love to know a trick to use the method I can't use but is there any way to do this without using the "new KeyValue()" construction?</p>