示例#1
0
        public void Send(NotificationContainer container)
        {
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }

            receiver.Receive(serializer.Serialize(container));
        }
        public string Serialize(NotificationContainer container)
        {
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }

            XmlSerializer formatter = new XmlSerializer(typeof(NotificationContainer));

            using (var stringWriter = new StringWriter())
            {
                formatter.Serialize(stringWriter, container);
                return(stringWriter.ToString());
            }
        }