-
Notifications
You must be signed in to change notification settings - Fork 24
/
NestedClass.cs
78 lines (64 loc) · 2.13 KB
/
NestedClass.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using Dotx64Dbg;
using System;
public class DataClass
{
public int Value = 0;
public DataClass(int val)
{
Value = val;
}
public override string ToString()
{
return $"{Value}";
}
}
// All classes that have the interface IHotload will fire the OnHotload event
// when the code is compiled and loaded.
public partial class NestedClass : IHotload
{
public static int MyNestedStatic = 0;
private int XY = 100;
private System.Collections.Generic.List<int> IntegerList = new() { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
private System.Collections.Generic.HashSet<string> StringSet = new() { "Hello", "World", "foo", "foo", "Bar", "Foo" };
DataClass[] ClassArray = new DataClass[10] {
new DataClass(1),
new DataClass(1),
new DataClass(1),
new DataClass(1),
new DataClass(1),
new DataClass(1),
new DataClass(1),
new DataClass(1),
new DataClass(1),
new DataClass(1)
};
private string NestedStringVar = "hello world";
public void TestFunc()
{
Console.WriteLine("NestedClass::TestFunc()");
Console.WriteLine("Test::IntegerList = {0}", string.Join(",", IntegerList));
Console.WriteLine("Test::StringSet = {0}", string.Join(",", StringSet));
Console.WriteLine("Test::NestedStringVar = {0}", NestedStringVar);
NestedStringVar = "I changed my string";
IntegerList.Add(500);
StringSet.Add("Test");
int i = 0;
foreach (var data in ClassArray)
{
data.Value = ++i;
}
}
public void OnHotload()
{
Console.WriteLine("Test::XY = {0}", XY);
Console.WriteLine("Test::MyNestedStatic = {0}", ++MyNestedStatic);
Console.WriteLine("Test::IntegerList = {0}", string.Join(",", IntegerList));
Console.WriteLine("Test::StringSet = {0}", string.Join(",", StringSet));
Console.WriteLine("Test::NestedStringVar = {0}", NestedStringVar);
int i = 0;
foreach (var data in ClassArray)
{
Console.WriteLine("Test::ClassArray[{0}] = {1}", i++, data);
}
}
}