전화를 걸 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;
}
}