CScripting 0.0.2

dotnet add package CScripting --version 0.0.2                
NuGet\Install-Package CScripting -Version 0.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CScripting" Version="0.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CScripting --version 0.0.2                
#r "nuget: CScripting, 0.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CScripting as a Cake Addin
#addin nuget:?package=CScripting&version=0.0.2

// Install CScripting as a Cake Tool
#tool nuget:?package=CScripting&version=0.0.2                

1. CScripting

GitHub stars Nuget Nuget GitHub 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

<div align=center> <table class="row"> <tr> <td class="col-6">

🔗 C#

#r "nuget: CScripting, *"
using static CScripting;

var addr = 0x12345678;
var addrr = hex(addr);

print(addr); // 305419896
print(addrr);

var val = 0x12345678;
var valr = bin(addr);

print(val); // 305419896
print(valr);

var c = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 };

print(c);
print(c, sep:"\t");

</td>

<td class="col-6">

🔗 Built-in

#r "nuget: CScripting, *"


addr = 0x12345678
addrr = hex(addr)

print(addr) # 305419896
print(addrr)

val = 0x12345678
valr = bin(addr)

print(val); # 305419896
print(valr)

c = [0, 1, 2, 3, 4, 5, 6, 7]

print(c)
print(c, sep="\t")

</td> </tr> </table> </div>

  • Output

<div align=center> <table class="row"> <tr> <td class="col-6">

C#

305419896
0x12345678
305419896
0b10010001101000101011001111000
{ 0, 1, 2, 3, 4, 5, 6, 7}
0	1	2	3	4	5	6	7

</td>

<td class="col-6">

Python

305419896
0x12345678
305419896
0b10010001101000101011001111000
[0, 1, 2, 3, 4, 5, 6, 7]
[0, 1, 2, 3, 4, 5, 6, 7]

</td> </tr> </table> </div>

1.4. Dotnet script and repl

~$ dotnet-script
> #r "nuget: CScripting, *"
> using static CScripting;
> hex(1024)
"0x400"
> print("Hello Scripy")
Hello Scripy

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__()
    • ???
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.2 264 5/18/2023
0.0.1 156 5/16/2023