Hello,
I'm new to generics and all I could find in C# is List[T] - nothing else.
This is the C++ code I have to translate in C#
template <class type>
type Read()
{
type t;
int s = sizeof(type);
if(index + s > size)
throw(std::exception("error 101"));
memcpy(&t, stream + index, s);
index += s;
return t;
}
Its called like that
BYTE mode = Read<BYTE>();
DWORD mode1 = Read<DWORD>();
WORD mode2 = Read<WORD>();
Question:How to do that with C# Generics?