public void Write(string value)
{
if (value == null)
{
m_Buffer.WriteByte2(0, 0);
return;
}
int byteCount = s_Encoding.GetByteCount(value);
if (byteCount >= 32768)
{
throw new IndexOutOfRangeException("Serialize(string) too long: " + value.Length);
}
Write((ushort)byteCount);
int bytes = s_Encoding.GetBytes(value, 0, value.Length, s_StringWriteBuffer, 0);
m_Buffer.WriteBytes(s_StringWriteBuffer, (ushort)bytes);
}