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