I can call Get(Stat); or Get(Name);
Get(Stat);
Get(Name);
But when compiling I get:
Cannot implicitly convert typ
Try this:
public T Get(Stats type ) where T : IConvertible { if (typeof(T) == typeof(int)) { return (T)(object)Convert.ToInt16(PlayerStats[type]); } if (typeof(T) == typeof(string)) { return (T)(object)PlayerStats[type]; } }