BinaryReader problem

  • Thread starter Thread starter Gintautas
  • Start date Start date
G

Gintautas

Hi
I'm trying to make read binary file to the data array, but a problem is
that the user is choosing either to read 1 byte(sbyte) or 2
bytes(Int16). So i need to make smth universal. My code:
public void Read<T>()
{
BinaryReader binRead = new BinaryReader(fStream);
T[] data = new T[dataCount];
for (uint i = 0; i < dataCount - 1; i++)
{
data = data = binRead.Read???
}
}

Do u have any suggestions???
 
Hi,
I've tried this method, but it doesn't want to write Byte to T type.
Casting doesn't help
 
Back
Top