-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
52 lines (40 loc) · 1.43 KB
/
Program.cs
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
using NeptuneSerialzer;
using System.Diagnostics;
namespace Example
{
public class TestClass
{
public string TestString = "Hello!";
public int TestInteger = 5;
public TestClassSecond[] ClassArrayTest = { new TestClassSecond(), new TestClassSecond() };
public float TestFloat = 3.14f;
public TestClassSecond testtwo = new();
public TestClass() { }
}
public class TestClassSecond
{
[NSerialize] private string PrivateValue = "This property is private, but is still Serialized due to [NSerialize]";
[NIgnore] public string PublicIgnoredValue = "This property is public, but will not be Serialized due to [NIgnore]";
public string PublicValue = "This property is public and will be Serialized.";
public bool TestBoolValue = true;
public bool[] TestBoolArray = { true, false, true };
public TestClassSecond() { }
}
public static class Program
{
static void Main()
{
TestClass testClass = new TestClass();
testClass.TestFloat = 52.50f;
Stopwatch stopwatch = Stopwatch.StartNew();
string SerializationString = NSerializer.Serialize(testClass);
stopwatch.Stop();
Console.WriteLine(SerializationString);
Console.WriteLine("" + stopwatch.Elapsed.TotalSeconds + "s taken to serialize.");
stopwatch.Restart();
object DeserializedObject = NSerializer.Deserialize(SerializationString);
stopwatch.Stop();
Console.WriteLine("" + stopwatch.Elapsed.TotalSeconds + "s taken to deserialize.");
}
}
}