title: C# Dictionary get item by index
body: <p>I am trying to make a method that returns a name of a card from my Dictionary
  randomly.</p>
  <p>My Dictionary: First defined name of the card which is string and second is the value of that card, which is int.</p>
  <pre><code>public static Dictionary&lt;string, int&gt; _dict = new Dictionary&lt;string, int&gt;()
      {
          {&quot;7&quot;, 7 },
          {&quot;8&quot;, 8 },
          {&quot;9&quot;, 9 },
          {&quot;10&quot;, 10 },
          {&quot;J&quot;, 1 },
          {&quot;Q&quot;, 1 },
          {&quot;K&quot;, 2 },
          {&quot;A&quot;, 11 }
      };
  </code></pre>
  <p>Method:
  <code>random</code> is a randomly generated int.</p>
  <pre><code>    public string getCard(int random)
      {
          return Karta._dict(random);
      }
  </code></pre>
  <p>So the problem is:</p>
  <blockquote>
  <p>Cannot convert from 'int' to 'string'</p>
  </blockquote>
  <p>Anybody helps me how should I do it right to get the name?</p>