This is the scenario:
There's a bug; you are ignoring the user's args, and you should probably guard for -ve returned
:
public override int Read(byte[] buffer, int index, int count)
{
long returned = dataReader.GetBytes(0, currentPosition,
buffer, 0, buffer.Length);
currentPosition += returned;
return Convert.ToInt32(returned);
}
should probably be:
public override int Read(byte[] buffer, int index, int count)
{
long returned = dataReader.GetBytes(0, currentPosition,
buffer, index, count);
if(returned > 0) currentPosition += returned;
return (int)returned;
}
(otherwise you are writing into the wrong part of the buffer)
But generally looks good.