Reputation: 129
Generally, I just want to know which streams in C# support seeking. I checked the docs and the Microsoft geniuses explained the concept, but didn't actually say which ones can be seeked.
Upvotes: 0
Views: 219
Reputation: 4329
As mentioned in the docs:
Streams can support seeking. Seeking refers to querying and modifying the current position within a stream. Seek capability depends on the kind of backing store a stream has. For example, network streams have no unified concept of a current position, and therefore typically do not support seeking.
You cannot just list all those who can seek, it depends on what backing store is behind the stream.
If you want to know if a stream can seek, examine the CanSeek
-Property. If it's true, you can use the seeking properties and methods available. Again, see the docs (remarks section).
If a class derived from Stream does not support seeking, calls to Length, SetLength, Position, and Seek throw a NotSupportedException.
Upvotes: 3