Sorry im newb and I don't know how to ask my question properly in the title. I have a database:
class PlayerData
{
public ulong id;
public string name;
public int kills;
public int deaths;
}
and I want to return the value corresponding to the requested key
object getStats(ulong uid, string stat)
{
var player = BasePlayer.FindByID(uid);
PlayerData data = PlayerData.Find(player);
object value = data.TryGetValue(stat); // I know this ain't right
return value;
}
example:
int kills = getStats(123456, kills); //will ask for the value of "kills" in the data. Return data.kills
stat could be anything in data (id, name, kills, deaths)
thanks alot!