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 开发者_Python百科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.
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.
精彩评论