开发者

DataInputStream.skip equivalent in C#

开发者 https://www.devze.com 2023-02-19 20:26 出处:网络
I am reading values from a byte array in a switch case, if none of the switch case matches, in the default I need to skip some number of by开发者_如何学Pythontes. In java it is achieved by using the D

I am reading values from a byte array in a switch case, if none of the switch case matches, in the default I need to skip some number of by开发者_如何学Pythontes. In java it is achieved by using the DataInputStream class method skip(numberOfbytes). how can we do the same in c#?


Either use Stream.Seek or (my personal preference) use the Position property:

stream.Position += bytesToSkip;

That assumes you're dealing with a seekable stream of course.

0

精彩评论

暂无评论...
验证码 换一张
取 消