forked from neo-project/examples
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStructExample2.cs
More file actions
47 lines (40 loc) · 999 Bytes
/
StructExample2.cs
File metadata and controls
47 lines (40 loc) · 999 Bytes
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
using Neo.SmartContract.Framework;
namespace StructExample
{
public class StructExample2 : SmartContract
{
public static Point2 Add(Point2 a, Point2 b)
{
return new Point2
{
X = a.X + b.X,
Y = a.Y + b.Y
};
}
public static Point2 Main()
{
Point2 p1 = new Point2
{
X = 1,
Y = 2
};
Point2 p2 = new Point2
{
X = 2,
Y = 1
};
Point2[] array = new[]
{
p1, p2
};
Point2 p3 = Add(array[0], array[1]);
Point2.Put("p1", p1);
Point2.Put("p2", p2);
Point2.Put("p3", p3);
Point2 p1get = Point2.Get("p1");
Point2 p2get = Point2.Get("p2");
Point2 p3get = Point2.Get("p3");
return p3get;
}
}
}