我正在上课,所以我可以在扫雷时作弊,目前正在建立一些仿制药...但我有点卡住了.我想返回一个int,但我如何转换它?
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");
}
您需要从调用中转换返回值 ChangeType
return (T)Convert.ChangeType(MemoryReader.ReadInt(adr), typeof(T));