9
ไม่สามารถแปลงประเภท 'Int' เป็น 'T' โดยปริยาย
โทรหาGet<int>(Stat);หรือGet<string>(Name); แต่เมื่อรวบรวมฉันจะได้รับ: ไม่สามารถแปลงประเภท 'int' เป็น 'T' โดยปริยาย stringและสิ่งเดียวกัน public T Get<T>(Stats type) where T : IConvertible { if (typeof(T) == typeof(int)) { int t = Convert.ToInt16(PlayerStats[type]); return t; } if (typeof(T) == typeof(string)) { string t = PlayerStats[type].ToString(); return t; } }