If you’re into linq here’s another solution:
public float GetStat(Stat stat, CharacterClass characterClass, int level)
{
try
{
var charClass = characterClasses.First(c => c.characterClass == characterClass);
var charStat = charClass.stats.First(s => s.stat == stat);
return charStat.levels[level - 1];
}
catch (Exception) // should never get here
{
return 0;
}
}