Exemple #1
0
        private object DeserializeInternal(Type t, string value)
        {
            if (Deserialize != null)
            {
                var e = new SerializationEventArgs(null, Text);
                Deserialize(this, e);
                return(e.PropertyObject);
            }

            using (StringReader sr = new StringReader(value))
            {
                XmlSerializer xs = new XmlSerializer(t);
                return(xs.Deserialize(sr));
            }
        }
Exemple #2
0
        private string SerializeInternal(object obj)
        {
            if (Serialize != null)
            {
                var e = new SerializationEventArgs(PropertyObject, null);
                Serialize(this, e);
                return(e.XmlString);
            }

            StringBuilder s = new StringBuilder();

            using (StringWriter sw = new StringWriter(s))
            {
                XmlSerializer xs = new XmlSerializer(obj.GetType());
                xs.Serialize(sw, obj);
                sw.Close();
            }
            return(s.ToString());
        }
Exemple #3
0
 void objectViewer1_Serialize(object sender, crudwork.Controls.DataTools.SerializationEventArgs e)
 {
     e.XmlString = Serializer.Serialize(e.PropertyObject, Serializer.SerializeMethods.Xml);
 }