You can wrap your MemoryStream
in a BinaryReader
:
using(var reader = new BinaryReader(yourStream)) {
int someInt = reader.ReadInt32();
}
The BinaryReader
can be found in the System.IO
namespace.
See MSDN for details on which methods you can use. Keep in mind that the methods follow the pattern of Read + the CLR type. So ReadInt32()
for int, ReadUInt16()
for short, etc.