.net – Reset or Clear .NET MemoryStream


The .NET MemoryStream does not appear to have a .Reset or .Clear method.

I was thinking of using the following code to accomplish this:

ms.Seek(0, IO.SeekOrigin.Begin)

What is the proper way to clear or reset an existing .NET MemoryStream?

Best Solution

Why do you need resetting memory stream? You always can create a new one. Or you can use: