how to read stream regardless of the position?

mc 3,201 Reputation points
2023-11-13T03:06:15.0166667+00:00

can read stream no matter what the current position is ?

if I have now write the stream then the position will be the length of the stream.

I do not want to change the position and I will write it in another thread.

can I read the data ?

Stream.Seek only return the position but no use of it.

how to read the data with out change the position?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
2,303 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
3,760 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 9,771 Reputation points Microsoft Vendor
    2023-11-13T05:42:59.1933333+00:00

    Hello @mc,

    Use the IRandomAccessStream.GetInputStreamAt(UInt64) Method to return an input stream at a specified location in a stream.

    See EnterpriseDataProtection for a sample.

    0 comments No comments