title: How do I get the Index of a key in a dictionary?
body: <p>So I have a <code>Dictionary</code> like so:</p>
  
  <pre><code>var dictionary = new Dictionary&lt;int,string&gt;();
  dictionary.Add(10,"Element 1");
  dictionary.Add(20, "Element 2");
  dictionary.Add(35, "Element 3");
  </code></pre>
  
  <p>Now I would like to get the <code>index</code> of the element where the key is <code>20</code></p>
  
  <p>Initially I thought:</p>
  
  <pre><code>dictionary.Keys.IndexOf(20);
  </code></pre>
  
  <p>but apparently this doesnt exist. So is what I'm looking to do possible?</p>
  
  <p>To clarify: I don't want to return the <code>Value</code> ("Element 2") where the key is <code>20</code> Instead I would like to return the <code>Index</code> based on where the items were inserted i.e. Where key = <code>20</code> the index would be <code>1</code></p>