Skip to content

Commit efbe38f

Browse files
committed
Updated readme.
1 parent 33bb1ff commit efbe38f

1 file changed

Lines changed: 23 additions & 10 deletions

File tree

README.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@ A .NET 8 project for compiling and executing C# code from strings at runtime usi
88
- Match methods to delegate signatures
99
- Create delegates for dynamically compiled methods
1010
- Example usage for both integer and string functions
11+
- Comprehensive test suite
12+
- Published as a NuGet package: `dynamic-code`
1113

1214
## Requirements
1315
- .NET 8 SDK
14-
- NuGet package: `Microsoft.CodeAnalysis.CSharp`
16+
- NuGet package: `dynamic-code` ([NuGet Gallery](https://www.nuget.org/packages/dynamic-code))
1517

16-
## Usage Example
18+
## Installation
19+
20+
Install the package from NuGet:
21+
dotnet add package dynamic-code
1722

18-
```
23+
## Usage Example
1924
csharp
2025
using DynamicCode;
2126

@@ -36,30 +41,38 @@ var intFuncType = DelegateTypeBuilder.Create()
3641
.AddOutput(typeof(int))
3742
.BuildFuncType();
3843

39-
var intFn = DynamicCompiler.CompileFunctionNew(intFuncType, code);
44+
var intFn = DynamicCompiler.CompileFunction(intFuncType, code);
4045

4146
var intResult = (int)intFn.DynamicInvoke(7, 6);
4247

4348
Console.WriteLine($"Function body:\r\n'{code}'");
4449
Console.WriteLine($"Function result is: {intResult}");
4550

46-
// The same thing, but in the different way
51+
// The same thing, but in a different way
4752

48-
var intFn1 = DynamicCompiler.CompileFunctionNew<Func<int, int, int>>(code);
53+
var intFn1 = DynamicCompiler.CompileFunction<Func<int, int, int>>(code);
4954

5055
intResult = intFn1(8, 9);
5156

5257
Console.WriteLine($"Function body:\r\n'{code}'");
5358
Console.WriteLine("x = 8, y = 9");
5459
Console.WriteLine($"Function result is: {intResult}");
55-
```
5660

5761
## Project Structure
58-
- `DynamicCompiler`: Main API for compiling code and creating delegates
59-
- `CompilerUtils`: Utilities for extracting class and method names from syntax trees
60-
- `SimpleDynamicCompiler`: Minimal example for compiling a specific function signature
62+
63+
- `DynamicCode/Compiler/` - Core compiler and utility classes
64+
- `DynamicCompiler`: Main API for compiling code and creating delegates
65+
- `CompilerUtils`: Utilities for extracting class and method names from syntax trees
66+
- `DelegateTypeBuilder`: Fluent builder for delegate types
67+
- `SimpleDynamicCompiler`: Minimal example for compiling a specific function signature
68+
- `DynamicCode.Test/` - Unit tests for all major features
6169
- `Program.cs`: Example usage
6270

71+
## Running Tests
72+
73+
To run the test suite:
74+
dotnet test
75+
6376
## License
6477
MIT License
6578

0 commit comments

Comments
 (0)