如何在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