views:

8

answers:

1

Is there a way to do this? I would like to know how many bytes were read from a NetworkStream when I call DeserializeWithLengthPrefix. Since NetworkStream does not support the Position property I cannot see a simple way to do this. Can this be done in a reasonably efficient way? I need to know this for profiling purposes, and it would be ideal to have the profiling overhead as low as possible.

+1  A: 

Oh, that is an excellent question. That isn't currently exposed, but if desired I could add an overload with an out bytesRead (to include both the overhead of the lentgh-prefix and the object itself, since both have been consumed). I'm trying to avoid too many changes to "v1", but I could certainly add that into "v2" without too much bother.

Marc Gravell
Thanks! That would be great. I am really looking forward to v2's release.
cloudraven
@cloudraven - for info, the changes weren't tricky (although they might have been for v1); I hanve't tested it yet, though.
Marc Gravell