如何在C#中重做该C++模板函数的声明?C#泛型 - 数组?
template <class type>
void ReadArray(type * array, unsigned short count)
{
int s = sizeof(type) * count;
if(index + s > size)
throw(std::exception("Error 102"));
memcpy(array, stream + index, s);
index += s;
}
当被调用时,它通过在一个特定的位置(索引)读取流(流)追加字节/字/给定的阵列中(类型)。
我试图重做这样的声明,但我得到一个错误
public static T void ReadArray(<T> Array inputarray) // error
{
...
}
谢谢!
另一个保守的问题 - 如何将字节追加到该数组(memcpy()),我应该使用一个指针?
什么是T空白? – 2009-04-20 07:05:14