Mercurial > pub > ImplabNet
diff Implab.Playground/Program.cs @ 229:5f7a3e1d32b9 v2
JsonXmlReader performance tuning
JsonScanner now operates strings and doesn't
parses number and literals.
Added SerializationHelpers to common serialize/deserialize operations
author | cin |
---|---|
date | Tue, 12 Sep 2017 19:07:42 +0300 |
parents | |
children | d6fe09f5592c |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Implab.Playground/Program.cs Tue Sep 12 19:07:42 2017 +0300 @@ -0,0 +1,42 @@ +using Implab.Formats.Json; +using Implab.Xml; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using System.Xml.Serialization; + +namespace Implab.Playground { + public class Program { + + [XmlRoot(Namespace = "XmlSimpleData")] + public class XmlSimpleModel { + [XmlElement] + public string Name { get; set; } + + [XmlElement] + public int Order { get; set; } + + [XmlElement] + public string[] Items { get; set; } + + } + + static void Main(string[] args) { + var model = new XmlSimpleModel { + Name = "Tablet", + Order = 10, + Items = new string[] { "z1", "z2", "z3" } + }; + + var doc = SerializationHelpers.SerializeAsXmlDocument(model); + + var m2 = SerializationHelpers.DeserializeFromXmlNode<XmlSimpleModel>(doc.DocumentElement); + + Console.WriteLine("done"); + } + } +}