I'm currently using this code:
And then I'm calling as such:
Rather than making a whole new Dictionary with {"Name","Numer"}, I'd like to know how I can get the Value to return the Key.
C#:
static class CharRanks
{
static Dictionary<string, string> Ranks = new Dictionary<string, string>
{
{"51", "Maj. Gen"},
{"52", "Lt. Gen"},
{"53", "General"},
{"54", "Admiral"}
};
public static string GetRanks(string Ranking)
{
// Get the result from the Ranks Dictionary.
string RankResult;
if (Ranks.TryGetValue(Ranking, out RankResult))
{
return RankResult;
}
else
{
return null;
}
}
}
_CharLvl.SelectedItem = CharRanks.GetRanks($"{CharLevelID}");
Rather than making a whole new Dictionary with {"Name","Numer"}, I'd like to know how I can get the Value to return the Key.