forked from technologists-team/hypercube-utilities
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
53 lines (46 loc) · 1.24 KB
/
Program.cs
File metadata and controls
53 lines (46 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using Hypercube.Utilities.Serialization.Hml;
using Hypercube.Utilities.Serialization.Hml.Core;
namespace Main;
public static class Program
{
public static void Main()
{
var data = new TestData
{
Name = "ТесмиДев",
Age = 20,
Object = new TestObject(),
Roles =
[
"Programmer",
"Driver"
],
Recursion = new TestData
{
Name = "TornadoTech",
Age = 0x1F1A,
Object = null!,
Roles = [],
Recursion = null,
}
};
var options = new HmlSerializerOptions
{
Eol = false,
Indented = true,
IndentSize = 2
};
var serialized = HmlSerializer.Serialize(data, options);
var deserialized = HmlSerializer.Deserialize<TestData>(serialized, options);
Console.WriteLine(serialized);
}
private class TestData
{
public string Name;
public int Age;
public TestObject Object;
public List<string> Roles;
public TestData? Recursion;
}
private class TestObject;
}