我正在上课,所以我可以欺骗扫雷,目前正在建立一些仿制药......但我有点卡住了。我想返回一个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");
}
为什么你想使用泛型,如果你想总是使用int? – Tommy 2011-04-29 09:20:15
为什么使用uint作为指针而不是专门为此设计的类型,UIntPtr?或者,为此,为什么不使用*指向int *的指针? – 2011-04-29 14:51:53
为什么有两个变量,一个叫做“地址”,一个叫做“adr”?他们的意思是一样的吗?他们之间有什么区别? – 2011-04-29 14:52:59