public XElement Serialize(MessageText messageText, string elementName = "text") { messageText.ThrowIfNull("messageText"); elementName.ThrowIfNull("elementName"); return new XElement( elementName, messageText.Text); }
public byte[] Serialize(MessageText messageText) { messageText.ThrowIfNull("messageText"); var serializer = new CompactSerializer(); serializer[0] = Encoding.UTF8.GetBytes(messageText.Text); return serializer.Serialize(); }