DataInputStream.skip equivalent in C#
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.
精彩评论