title: convert array to dictionary c# with int and string
body: <p>I have a string array with strings and a dictionary.</p>
  
  <pre><code>String [] str_array;
  Dictionary&lt;int, string&gt; dict = new Dictionary&lt;int, string&gt;();
  
  dict = str_array.toDictionary();
  </code></pre>
  
  <p>How do I get my array into a dictionary with int and String?
  I have seen all those examples with bool, but I need int and string. </p>
  
  <p>The int (key) would be just the actual position of the dictionary (dict.count) and the value would be the value of the array at that position.</p>
  
  <p>edit: thx to all answers but I do not want to iterate over array. I assume that with array.toDictionary the performance would be better than iterating over array and just assigning the value of the array to a dictionary. Arrays might have 5k elements.</p>
  
  <p>edit2: the reason is that i have to pass a dictionary to a method...its REQUIRED. and all my values are within a simple array.</p>
  
  <p><strong>edit3:</strong> The most important thing is <strong>performance</strong>. Maybe iterating over array and assigning values to dict is faster than array.toDictionary, but the problem is that i do not have that little piece of code to benchmark both.</p>