Skip to content

Repository files navigation

1. CScripting

Visualization of the codebase

GitHub starsNugetNugetGitHub release

1.1. Instruction

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

1.2. Recent Changelog

  • time: 2023年5月15日
  • version: 1.0.6
  • log:
    1. change readme
    2. add help function
    3. add dir function
    4. fix trim print() last sep

more information, see CHANGELOG.md

1.3. Demo

  • 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

1.5. Extended function list

  • MyOwn
    • load()
    • unload()

1.6. Extended function list like Matlab

  • coming
    • ???
    • ????

1.7. Python Built-in function list

  • A

  • B

  • 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

  • R

    • range()
    • repr()
    • reversed()
    • round()
  • S

    • set()
    • setattr()
    • slice()
    • sorted()
    • staticmethod()
    • str()
    • sum()
    • super()
  • T

    • tuple()
    • type()
  • V

    • [ ]vars()
  • Z

    • zip()
  • misc

    • _
    • __import__()
    • ???

Releases

Packages

Used by

Contributors

Languages