internal byte[] WriteBinary() { MemoryStream ms = new MemoryStream(); BinaryWriter bw = new BinaryWriter(ms); bw.Write(MajorVersion); bw.Write(MinorVersion); bw.Write((int)Flags); byte[] header = Header.WriteBinary(); bw.Write((uint)header.Length); bw.Write(header); bw.Write(Verifier.WriteBinary()); bw.Flush(); return(ms.ToArray()); }
internal byte[] WriteBinary() { using (var ms = RecyclableMemory.GetStream()) { BinaryWriter bw = new BinaryWriter(ms); bw.Write(MajorVersion); bw.Write(MinorVersion); bw.Write((int)Flags); byte[] header = Header.WriteBinary(); bw.Write((uint)header.Length); bw.Write(header); bw.Write(Verifier.WriteBinary()); bw.Flush(); return(ms.ToArray()); } }