write c# script like python
!!! tip 思路
我们主要是想在 C# 实现 Python 的内置函数,并在C# 中可以直接使用, 以便提高简单脚本的编写效率。
!!! tip 欢迎 ❤️
欢迎 任何 PR
!!! tip idea
We aim to implement the built-in function of python in C# and direct use in C# to improve the effect.
!!! tip **Welcome** ❤️
welcome any pull request
- time: 2023年5月15日
- version: 1.0.6
- log:
- change readme
- add
helpfunction - add
dirfunction - fix trim
print()last sep
more information, see CHANGELOG.md
Code
🔗 C# #r "nuget: CScripting, *"usingstaticCScripting;varaddr=0x12345678;varaddrr=hex(addr);print(addr);// 305419896print(addrr);varval=0x12345678;varvalr=bin(addr);print(val);// 305419896print(valr);varc=newint[]{0,1,2,3,4,5,6,7};print(c);print(c,sep:"\t"); | 🔗 Python #r "nuget: CScripting, *"addr=0x12345678addrr=hex(addr)
print(addr) # 305419896print(addrr)
val=0x12345678valr=bin(addr)
print(val); # 305419896print(valr)
c= [0, 1, 2, 3, 4, 5, 6, 7]
print(c)
print(c, sep="\t") |
Output
C# 3054198960x123456783054198960b10010001101000101011001111000{0,1,2,3,4,5,6,7}01234567 | Python 3054198960x123456783054198960b10010001101000101011001111000
[0, 1, 2, 3, 4, 5, 6, 7]
[0, 1, 2, 3, 4, 5, 6, 7] |
~$ dotnet-script
>#r "nuget: CScripting, *"> using static CScripting;> hex(1024)
"0x400"> print("Hello CScripting")
Hello CScripting
- MyOwn
load()unload()
- coming
???????
A
B
bin()bool()breakpoint()bytearray()bytes()
C
callable()chr()classmethod()compile()**complex()**
D
delattr()dict()dir()*divmod()
E
enumerate()eval()exec()
F
filter()float()format()frozenset()
G
getattr()globals()
H
I
id()input()int()isinstance()issubclass()iter()
L
len()list()locals()
M
map()max()memoryview()min()
N
next()
O
P
pow()print()property()
R
range()repr()reversed()round()
S
set()setattr()slice()sorted()staticmethod()str()sum()super()
T
tuple()type()
V
- [ ]
vars()
- [ ]
Z
zip()
misc
___import__()???