229
|
1 using Implab.Formats.Json;
|
|
2 using Implab.Xml;
|
|
3 using System;
|
|
4 using System.Collections.Generic;
|
|
5 using System.IO;
|
|
6 using System.Linq;
|
|
7 using System.Text;
|
|
8 using System.Threading.Tasks;
|
|
9 using System.Xml;
|
|
10 using System.Xml.Serialization;
|
|
11
|
|
12 namespace Implab.Playground {
|
|
13 public class Program {
|
|
14
|
|
15 [XmlRoot(Namespace = "XmlSimpleData")]
|
|
16 public class XmlSimpleModel {
|
|
17 [XmlElement]
|
|
18 public string Name { get; set; }
|
|
19
|
|
20 [XmlElement]
|
|
21 public int Order { get; set; }
|
|
22
|
|
23 [XmlElement]
|
|
24 public string[] Items { get; set; }
|
|
25
|
|
26 }
|
|
27
|
|
28 static void Main(string[] args) {
|
|
29 var model = new XmlSimpleModel {
|
|
30 Name = "Tablet",
|
|
31 Order = 10,
|
|
32 Items = new string[] { "z1", "z2", "z3" }
|
|
33 };
|
|
34
|
|
35 var doc = SerializationHelpers.SerializeAsXmlDocument(model);
|
|
36
|
|
37 var m2 = SerializationHelpers.DeserializeFromXmlNode<XmlSimpleModel>(doc.DocumentElement);
|
|
38
|
|
39 Console.WriteLine("done");
|
|
40 }
|
|
41 }
|
|
42 }
|