BinaryReader problem

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???
 
G

Gintautas

Hi,
I've tried this method, but it doesn't want to write Byte to T type.
Casting doesn't help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top