コード例 #1
0
        public XElement Serialize(MessageText messageText, string elementName = "text")
        {
            messageText.ThrowIfNull("messageText");
            elementName.ThrowIfNull("elementName");

            return new XElement(
                elementName,
                messageText.Text);
        }
コード例 #2
0
        public byte[] Serialize(MessageText messageText)
        {
            messageText.ThrowIfNull("messageText");

            var serializer = new CompactSerializer();

            serializer[0] = Encoding.UTF8.GetBytes(messageText.Text);

            return serializer.Serialize();
        }