public static void WriteString (this Stream stream, string s) { stream.WriteInt (s.Length); byte [] bytes = Encoding.UTF8.GetBytes (s); stream.Write (bytes, 0, bytes.Length); } }