If I am given a MemoryStream
that I know has been populated with a String
, how do I get a String
back out?
12 s
You can also use
Encoding.ASCII.GetString(ms.ToArray());
I don’t think this is less efficient, but I couldn’t swear to it. It also lets you choose a different encoding, whereas using a StreamReader you’d have to specify that as a parameter.