public void SetLength() { if (!lenIsSet) { ms.Position = 0; ms.Write(BitConverter.GetBytes(Convert.ToUInt16(ms.Length)), 0, 2); } }