Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whiteblackgoose/naivecsharpfsharpeval
This package is only to test something. It synchronously evaluates C# or F# code and returns the string output.
https://github.com/whiteblackgoose/naivecsharpfsharpeval
Last synced: 18 days ago
JSON representation
This package is only to test something. It synchronously evaluates C# or F# code and returns the string output.
- Host: GitHub
- URL: https://github.com/whiteblackgoose/naivecsharpfsharpeval
- Owner: WhiteBlackGoose
- License: mit
- Created: 2021-08-31T17:34:20.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-31T19:17:48.000Z (about 3 years ago)
- Last Synced: 2024-10-19T18:47:05.453Z (30 days ago)
- Language: F#
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Naive # Eval
[![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/NaiveSharpEval?label=NuGet&logo=nuget)](https://www.nuget.org/packages/NaiveSharpEval/)
This package is only to test something. It synchronously evaluates C# or F# code and returns the string output if succeeded.
## Examples
### Call C# from C#
```cs
if (NaiveSharpEval.Executor.ExecuteCSharp("(double)(1 + 2)", out var res))
Console.WriteLine(res);
else
Console.WriteLine("Error!");
```### Call F# from C#
```cs
if (NaiveSharpEval.Executor.ExecuteFSharp("(+) 1 2", out var res))
Console.WriteLine(res);
else
Console.WriteLine("Error!");
```### Call C# from F#
```fs
match NaiveSharpEval.Executor.ExecuteCSharp "(double)(1 + 2)" with
| (true, res) -> printfn "%s" res
| _ -> printfn "%s" "Error!"
```### Call F# from F#
```fs
match NaiveSharpEval.Executor.ExecuteFSharp "(+) 1 2" with
| (true, res) -> printfn "%s" res
| _ -> printfn "%s" "Error!"
```