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: 23 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 (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-31T19:17:48.000Z (almost 4 years ago)
- Last Synced: 2025-04-02T06:09:27.028Z (3 months 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
[](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!"
```