-
Notifications
You must be signed in to change notification settings - Fork 0
/
CScripting.Demo.dib
76 lines (47 loc) · 963 Bytes
/
CScripting.Demo.dib
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
#!meta
{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"languageName":"csharp","name":"csharp"}]}}
#!markdown
## CScripting
demo of CScripting
#!markdown
## ref the package
- ref nuget package
#!csharp
#r "nuget: CScripting, *"
#!markdown
- using the static functions in `CScripting`
#!csharp
using static CScripting;
#!markdown
## usage
write script like python
#!csharp
var addr = 0x12345678;
var addrr = hex(addr);
print("hex");
print(addr); // 305419896
print(addrr);
var val = 0x12345678;
var valr = bin(addr);
print("bin");
print(val); // 305419896
print(valr);
var octs = 0x12345678;
var octr = oct(octs);
print("oct");
print(octs); // 305419896
print(octr);
var c = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 };
print(c);
print(c, sep:"\t");
print(c, sep:"+");
#!csharp
var _12 = abs(-15.6);
print(_12);
#!markdown
### help
#!csharp
help(typeof(System.Math));
help(typeof(System.IO.File));
#!csharp
print(bytes(5))