我正在制作一个类,以便在扫雷游戏中作弊,目前正在建立一些通用模板...但我有点卡住了。我想返回一个整数,但如何进行转换呢?
public T ReadMemory<T>(uint adr)
{
if( address != int.MinValue )
if( typeof(T) == typeof(int) )
return Convert.ChangeType(MemoryReader.ReadInt(adr), typeof(T));
else
MessageBox.Show("Unknown read type");
}